Strip control codes and extended characters from a string: Difference between revisions

From Rosetta Code
Content added Content deleted
m (wordliness)
(Non Ascii Based Systems)
Line 5: Line 5:
* a string with control codes stripped (but extended characters not stripped)
* a string with control codes stripped (but extended characters not stripped)
* a string with control codes and extended characters stripped
* a string with control codes and extended characters stripped

=== Ascii ===
=== Ascii ===


In ascii, the control codes have decimal codes 0 through to 31 and the extended characters have decimal codes greater than 127. On an ascii based system, if the control codes and the extended characters are stripped, the resultant string would have all of its characters within the range of 32 to 127 on the ascii table.
In ascii, the control codes have decimal codes 0 through to 31 and the extended characters have decimal codes greater than 127. On an ascii based system, if the control codes and the extended characters are stripped, the resultant string would have all of its characters within the range of 32 to 127 decimal on the ascii table.

=== Non Ascii Based Systems ===

On a non ascii based system, we consider characters that do not have a corresponding glyph on the ascii table (within the ascii range of 32 to 127 decimal) to be an extended character for the purpose of this task.


[[Category:String manipulation]]
[[Category:String manipulation]]

Revision as of 10:30, 5 June 2011

Strip control codes and extended characters from a string is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

The task is to strip control codes and extended characters from a string. The solution should demonstrate how to achieve each of the following results:

  • a string with control codes stripped (but extended characters not stripped)
  • a string with control codes and extended characters stripped

Ascii

In ascii, the control codes have decimal codes 0 through to 31 and the extended characters have decimal codes greater than 127. On an ascii based system, if the control codes and the extended characters are stripped, the resultant string would have all of its characters within the range of 32 to 127 decimal on the ascii table.

Non Ascii Based Systems

On a non ascii based system, we consider characters that do not have a corresponding glyph on the ascii table (within the ascii range of 32 to 127 decimal) to be an extended character for the purpose of this task.