Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String 在PowerBuilder中循环字符串_String_Loops_Powerbuilder - Fatal编程技术网

String 在PowerBuilder中循环字符串

String 在PowerBuilder中循环字符串,string,loops,powerbuilder,String,Loops,Powerbuilder,首先,我是PowerBuilder的noob,似乎在任何地方都找不到如何做到这一点 我一直被赋予在工作中重写应用程序的任务。我的老板希望新的应用程序尽可能模仿旧的应用程序,这就引出了我的问题。有一个日期字段,它允许日期输入以波浪号分隔(01/01/15~01/31/15),并使用该字段获取BEVER SQL语句的开始日期和结束日期 说到这里,我正试图在PowerBuilder12.6Classic中做同样的事情。我知道我可以通过使用两个日期选择器(开始日期和结束日期)完成同样的事情,但我的老板希

首先,我是PowerBuilder的noob,似乎在任何地方都找不到如何做到这一点

我一直被赋予在工作中重写应用程序的任务。我的老板希望新的应用程序尽可能模仿旧的应用程序,这就引出了我的问题。有一个日期字段,它允许日期输入以波浪号分隔(01/01/15~01/31/15),并使用该字段获取BEVER SQL语句的开始日期和结束日期

说到这里,我正试图在PowerBuilder12.6Classic中做同样的事情。我知道我可以通过使用两个日期选择器(开始日期和结束日期)完成同样的事情,但我的老板希望这种转换对最终用户来说尽可能无缝

我的表单上有一个sle_date_,当前采用mm/dd/yy的日期格式并将对其进行处理,但我希望允许mm/dd/yy~mm/dd/yy并解析出开始和结束日期。我的伪代码如下所示:

int i
String s
String start_date
String end_date

if this.textsize > 8 then
   s = this.text(value of this position in the string)
   start_date = s + s
   if this.text = "~" then
      s = s + 1
      s = this.text(value of this position in the string)
      end_date = s + s
   end if 
   this.textsize + 1
else
   start_date = this.text
end if
我确实意识到我的伪代码可能需要一些工作,我只是想让大家明白这一点

谢谢

不要循环

string ls_start, ls_end
ls_start = left( this.text, pos( this.text, '~' ) - 1)
ls_end   = right( this.text, Len( this.text) - pos( this.text, '~'))

-保罗·霍兰——

哇!谢谢如果您知道自己在做什么,那么PowerBuilder非常简单。这太棒了!我正准备将字符串转换成一个字符数组,并在其中循环,哈哈。只要确保“测试”日期,以确保它们确实是日期。您可以使用IsDate方法进行此操作。