Difference between revisions of "Reading a Substring from a variable"

From ArcoWiki
Jump to: navigation, search
 
(One intermediate revision by one other user not shown)
Line 21: Line 21:
 
::::::<code>char_list[i]=ASSIGN/str2</code>
 
::::::<code>char_list[i]=ASSIGN/str2</code>
 
::::<code>ENDDO</code>
 
::::<code>ENDDO</code>
 +
 +
[[it:Lettura di una sottostringa da una variabile]]
 +
[[zh-cn:从变量中读取一个子字符串]]
 +
[[pt:Lendo um Substring de uma Variável]]
 +
[[de:Einen Teilstring von einer Variablen lesen]]
 +
[[es:Lectura de una subcadena de una variable]]
 +
[[en:Reading a Substring from a variable]]
  
 
[[Category:Dmis_Tutorial]]
 
[[Category:Dmis_Tutorial]]

Latest revision as of 07:30, 15 June 2018

This is used to extract a sub-string from a string.

  • Extracting a Feature:
$$Declaring Base Variable
DECL/CHAR,100,str1,str2
str1=ASSIGN/'My full String'
$$Reading the word from char #4 to char #7
str2=ASSIGN/SUBSTR(str1,4,7)


  • This is used to read a string “char by char”:
$$Declaring Base Variable
DECL/CHAR,100,str1,str2,char_list[15]
DECL/INTGR,len_string,i
str1=ASSIGN/'My full String'
len_string=ASSIGN/LEN(str1)
$$Loop to read single char
DO/i,1,len_string
str2=ASSIGN/SUBSTR(str1,i,i)
char_list[i]=ASSIGN/str2
ENDDO