J
jmls
Guest
meh. ok , just for you
method public longchar parseString(p_string as char): def var lv_data as longchar no-undo. def var lv_i as int no-undo. fix-codepage(lv_Data) = "UTF-8":u. assign lv_data = p_string. /** no need to parse if \ is not present as there are no escapes */ if index(lv_Data,"\") gt 0 then do: assign lv_data = replace(lv_Data,'~\"','"') lv_data = replace(lv_Data,'~\~\','\') lv_data = replace(lv_Data,'~\/','/') lv_data = replace(lv_Data,'~\b','~b') lv_data = replace(lv_Data,'~\f','~f') lv_data = replace(lv_Data,'~\n','~n') lv_data = replace(lv_Data,'~\r','~r') lv_data = replace(lv_Data,'~\t','~t') lv_i = index(lv_Data,"\u"). /** handle unicode string */ do while lv_i gt 0: assign lv_unicode = substr(lv_data,lv_i + 2,4). lv_i = index(lv_Data,"\u"). /** more unicode handling */ end. /** more parsing stuff */ /** etc etc etc */ end. return lv_data. end method. so now I need to have a needless do .. end block with the indentation that comes with it. looks messy. and the whole point is that the return in the finally .. end finally block works for all other datatypes except longchar
Continue reading...

Continue reading...