How to split a string and make an array of integers in crystal report

前端 未结 2 1227
野的像风
野的像风 2020-12-17 03:33

I have a string with set of employee IDs separated by an _(Underscore). What i want to do is to split that into separate strings and convert them to integers and save them

2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-17 04:00

    //create an array of strings by parsing a underscore-delimited string field
    Stringvar Array strings := Split({table.string_field}, "_");
    
    //empty numeric array; sized to match
    Numbervar Array numbers;
    Redim numbers[Ubound(strings)];
    
    //populate array
    Numbervar i;
    for i := 1 to Ubound(strings) do (
      numbers[i] := ToNumber(strings[i])
    );
    
    //return
    numbers;
    

提交回复
热议问题