From WikiChip
Difference between revisions of "string manipulation"

(Created page with "'''String manipulation''' (or '''string handling''') is a mechanism or a library feature of most programming languages that provides the capabilities of performing various...")
 
m
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''String manipulation''' (or '''string handling''') is a mechanism or a library feature of most [[programming language]]s that provides the capabilities of performing various operations on [[string]]s. Typically such operations include performing basic tasks such as concatenation, copying, tokenization, searching, and replacing.
+
'''String manipulation''' (or '''string handling''') is the process of changing, parsing, splicing, pasting, or analyzing [[strings]]. String manipulation typically comes as a mechanism or a library feature of in most [[programming language]]s.
  
 
Typically, most programming languages provide a [[string]] [[data type]] that holds a sequence of characters. Such types often expose a set of [[function]]s and various other low-level functionality for manipulating the contained characters.
 
Typically, most programming languages provide a [[string]] [[data type]] that holds a sequence of characters. Such types often expose a set of [[function]]s and various other low-level functionality for manipulating the contained characters.
  
Below is a summary of various string manipulation facilities in different languages.
+
== Common operations ==
  
== ALGOL ==
+
*'''[[Concatenation - string manipulation|Concatenation]]''' is the process of joining two [[strings]] together into a single string. For example "<code>race</code>" concatenated with "<code>car</code>" results in "<code>racecar</code>".
{{main|String manipulation - ALGOL|l1=String manipulation}}
+
*'''[[Splitting - string manipulation|Splitting]]''' is the process of breaking down a string into multiple strings according to a certain [[delimiter]] or rule (e.g. [[regex]] pattern). For example "<code>A B C</code>" could be split into three separate strings, ("<code>A</code>", "<code>B</code>", "<code>C</code>"), using the space character as a delimiter.
 +
*'''[[Substrings - string manipulation|Substrings]]''' is the process of extracting a portion of the string from a bigger string. Such operations typically involve a starting offset and a length. For example, one possible substring of "<code>apples</code>" is "<code>pp</code>".
 +
*'''[[Case conversion - string manipulation|Case conversion]]''' is the process of converting a string into a specific case for example into all lowercase or [[titlecase]].
 +
*'''[[Searching - string manipulation|Searching]]''' is the process of searching for a specific pattern in a string.
  
== C# ==
+
== In various languages ==
{{main|String manipulation - C Sharp|l1=String manipulation}}
+
Most programming languages provide a built-in mechanism or library functions for manipulating strings.
  
== C ==
+
{| id="mp-langs1" style="margin:4px 0 0 0; width:70%; background:none; border-spacing: 0px;"
{{main|String handling - C|l1=String handling}}
+
| class="MainPageBG" style="width:100%;  vertical-align:top; color:#000;" |
 +
{| id="mp-bottom" style="width:100%; vertical-align:top; "
 +
| style="width:5%; font-size:95%; vertical-align: top;" |
  
== C++ ==
+
* [[algol/string manipulation|ALGOL]]
{{main|String manipulation - C++|l1=String manipulation}}
+
* [[c sharp/string manipulation|C Sharp]]
 +
* {{C|string handling|C}}
 +
* [[c++/string manipulation|C++]]
 +
* [[delphi/string manipulation|Delphi]]
  
== Delphi ==
+
| style="width:5%; font-size:95%; vertical-align:top;" |
{{main|String manipulation - Delphi|l1=String manipulation}}
+
* [[go/string manipulation|Go]]
 +
* [[haskell/string manipulation|Haskell]]
 +
* [[java/string manipulation|Java]]
 +
* [[javascript/string manipulation|JavaScript]]
 +
* [[lua/string manipulation|Lua]]
  
== Go ==
+
| style="width:5%; font-size:95%; vertical-align:top;" |
{{main|String manipulation - Go|l1=String manipulation}}
+
* {{mIRC|string manipulation|mIRC}}
 +
* [[php/string manipulation|PHP]]
 +
* [[python/string manipulation|Python]]
 +
* [[ruby/string manipulation|Ruby]]
  
== Haskell ==
+
|}
{{main|String manipulation - Haskell|l1=String manipulation}}
+
|}
  
== Java ==
+
[[Category:string]]
{{main|String manipulation - Java|l1=String manipulation}}
 
 
 
== JavaScript ==
 
{{main|String manipulation - JavaScript|l1=String manipulation}}
 
 
 
== Lua ==
 
{{main|String manipulation - Lua|l1=String manipulation}}
 
 
 
== mIRC ==
 
{{main|String manipulation - mIRC|l1=String manipulation}}
 
 
 
== PHP ==
 
{{main|String manipulation - PHP|l1=String manipulation}}
 
 
 
== Python ==
 
{{main|String manipulation - Python|l1=String manipulation}}
 
 
 
== Ruby ==
 
{{main|String manipulation - Ruby|l1=String manipulation}}
 

Latest revision as of 10:08, 4 January 2015

String manipulation (or string handling) is the process of changing, parsing, splicing, pasting, or analyzing strings. String manipulation typically comes as a mechanism or a library feature of in most programming languages.

Typically, most programming languages provide a string data type that holds a sequence of characters. Such types often expose a set of functions and various other low-level functionality for manipulating the contained characters.

Common operations[edit]

  • Concatenation is the process of joining two strings together into a single string. For example "race" concatenated with "car" results in "racecar".
  • Splitting is the process of breaking down a string into multiple strings according to a certain delimiter or rule (e.g. regex pattern). For example "A B C" could be split into three separate strings, ("A", "B", "C"), using the space character as a delimiter.
  • Substrings is the process of extracting a portion of the string from a bigger string. Such operations typically involve a starting offset and a length. For example, one possible substring of "apples" is "pp".
  • Case conversion is the process of converting a string into a specific case for example into all lowercase or titlecase.
  • Searching is the process of searching for a specific pattern in a string.

In various languages[edit]

Most programming languages provide a built-in mechanism or library functions for manipulating strings.