Split a character string based on change of character: Difference between revisions
Split a character string based on change of character (view source)
Revision as of 08:21, 28 June 2022
, 2 years ago→{{header|FutureBasic}}
No edit summary |
|||
Line 1,209:
<lang>
local fn SplitString( inputStr as CFStringRef ) as CFStringRef
CFStringRef resultStr
NSUInteger i
if len( inputStr ) < 2 then resultStr = inputStr : exit fn
resultStr = left( inputStr, 1 )
for i = 2 to len( inputStr )
if fn StringIsEqual( mid( inputStr, i, 1 )
resultStr = fn StringWithFormat( @"%@%@", resultStr, mid( inputStr, i, 1 ) )
next
i = len( resultStr ) - 2
resultStr = fn StringByReplacingCharactersInRange( resultStr, fn CFRangeMake( i, 1 ), @"" )
end fn = resultStr
Line 1,232:
g, HHH, 5, YY, ++, ///, \
</pre>
=={{header|Go}}==
|