如:数据库中有一个经度数据is_jingdu (如:123°45″2′),我现在想将度,分,秒的值分别读出至sle1.text,sle2.text,sle3.text,请问这应当如何编写语言??(注:度分秒的位数不一定)
请高手指点!!
------解决方案--------------------
- C/C++ code
string ls_jd = "123°45″2′"string ls_d, ls_f, ls_mlong ll_pd, ll_pf, ll_pmll_pd = pos(ls_jd, '°')if ll_pd > 0 then ls_d = trim(left(ls_jd, ll_pd - 1)) //取得度end ifll_pf = pos(ls_jd, '″', ll_pd + 1)if ll_pf > 0 then ls_f = trim(mid(ls_jd, ll_pd + 1, ll_pf - ll_pd - 1)) //取得分end ifll_pm = pos(ls_jd, '′', ll_pf + 1)if ll_pm > 0 then ls_m = trim(mid(ls_jd, ll_pf + 1, ll_pm - ll_pf - 1)) //取得秒end if
------解决方案--------------------
引入的时候是字符集问题,截取的时候记得处理全角和半角就可以了