strsplit

From DavinciWiki
Jump to: navigation, search

Description

The strsplit function splits the input string (or TEXT array) by a specified delimiter.

Arguments and Return Values

Inputs: A string or text array and a delimiter

Returns: A text array or a structure of text arrays

Usage

Syntax: strpslit(String/Text Array [,delim=STRING])

String/Text Array is the input string or array of strings

delim is the input delimiter, default is a ","

Examples

Text array as an input

dv> string
Text Buffer with 3 lines of text
   1: Hi, My Name is
   2: Hi, My, Name is
   3: Hi, My, Name, is

Split just the first line of the input

dv> one=strsplit(string[,1])
Text Buffer with 2 lines of text
   1: Hi
   2:  My Name is

Split the entire text array

dv> all=strsplit(string)
struct, 3 elements
   1: Text Buffer with 2 lines of text
       1: Hi
       2:  My Name is
   2: Text Buffer with 3 lines of text
       1: Hi
       2:  My
       3:  Name is
   3: Text Buffer with 4 lines of text
       1: Hi
       2:  My
       3:  Name
       4:  is

Example where no delimiter was found

dv> all=strsplit(string,delim="\t")
No delimiter was found

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Major Sub-Functions

Related Functions

Recent Library Changes

Created On: 05-06-2010
Modified On: 05-06-2010

Personal tools