fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 221: Remove all non-digits characters
Idiom # 221: Remove all non-digits characters
See
programming-idioms.org
:
Code
t := s.as_codepoints .filter (cp -> "0" <= cp <= "9") .as_string ""
What are effects?
Running Example
ex221 is s := "Create string t from string s, keeping only digit characters 0, 1, 2, 3, 4, 5, 6, 7, 8, 9." t := s.as_codepoints .filter (cp -> "0" <= cp <= "9") .as_string "" say t
What are effects?
last changed: 2024-07-01
next: Idiom # 222: Find first index of an element in list