Home > database >  Excuse me, how to comma separator to split a string
Excuse me, how to comma separator to split a string

Time:09-25

How to comma separator to split a string
Please instruct
NA, 10,31,11,10,10 FEALSOL, HRB400V HRB400V, A,, 1,,,,,,,,,,, 29 C, 0.07, 0.03, Mn, Si, 0.09 P, 0.024 S, 0.022, 0.000, Nb, V, 0.00094, 0.009, Cr, 0.009, Cu, Ni, Alsol, 0.027, 0.3581, Aloxy,, Al, 0.41877, 0.0607, 0.00859, As B, 0.00058, 0.00010, Ca. 0.00442, Co, Bi, 0.00529, 0.00086, Pb, Mo, 0.00152, 0.00056, Sn, Sb, Ti, 0.01098, 0.00088 W, 0.00010, zinc, 0.00891, Zr, 0.00058, 0.85517, Fe4, F, and FE %, 99.2547,

CodePudding user response:

Into an array of strings? Write a function, use cycle,, (with pos function, location)

CodePudding user response:

////////////////////////////////////////////
//count: the refs as_mother string
//as_flag specified marks
//which a specified marks ai_point
//return back value: string
////////////////////////////////////////////
String ls_ret
Long ll_start ll_end, ll_i
Ll_end=0
If ai_point=0 then
Return as_mother
End the if
For ll_i=1 to ai_point
Ll_start=ll_end + 1
Ll_end=posw (as_mother as_flag, ll_start)
Next
Ls_ret=Mid (as_mother ll_start, ll_end - ll_start)
Return ls_ret

CodePudding user response:

 
//the String Function GET_TOKEN (ref String Source, char Separator)

//The function Get_Token receive, as The arguments, The string from which
//the token is to be stripped off, from the left, and the separator
//character. If the separator character does not appear in the string,
//it returns the - string. Otherwise, it returns the token, not
//o the separator character. In either case, the source string
//is truncated on the left, by the length of the token and the separator
//character, if any.


Int p
String ret

P=Pos (source, the separator)//Get the position of the separator

If p=0 then//if no separator,
Ret=source//return the whole source string and
The source=""//make the the original source of the zero length
The else
Ret=Mid (source, 1, p - 1)//otherwise, the return just the token and
Source=Right (source, Len (source) - p)//strip it & amp; The separator
End the if

Return ret


A method is called:
The do while ls_source & lt;> "
"Ls_buf=f_get_Token (ls_source, ", ")
//..
loop

CodePudding user response:

The
reference 3 floor msgtogcr response:
c # code

//the String Function GET_TOKEN (ref String Source, char Separator)

//The function Get_Token receive, as The arguments, The string from which
//the token is to be stripped off, from the left...


Agree with the upstairs, if you have special needs, can return arrays, more convenient for operation,

CodePudding user response:

POS
+
Cycle!

CodePudding user response:

PFC to achieve the most simple, ready-made
N_cst_string lnv_string
String ls_value, ls_sep
Ls_sep=lnv_string. Of_gettoken (ls_value, ', ')

CodePudding user response:

Support with PFC

CodePudding user response:

Method agree with the second floor
  • Related