Posts Tagged ‘array’

Strings in python can be split using any given delimeter. Unlike other languages, the delimeter can be a string of any length; it’s not limited to one character. To do this, you can use the <string>.split(<delimeter>) function. Similarly, you can join an array of strings back into one string, using any defined string to join […]

If you’ve got a string of items in bash which are delimited by a common character (comma, space, tab, etc) you can split that into an array quite easily. Simply (re)define the IFS variable to the delimiter character and assign the values to a new variable using the array=($<string_var>) syntax. The new variable will now […]