在 PowerBuilder 中循环遍历一个字符串

Loop through a string in PowerBuilder

首先,我是 PowerBuilder 的新手,似乎无法在任何地方找到如何执行此操作。

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

综上所述,我正尝试在 PowerBuilder 12.6 经典版中做同样的事情。我知道我可以通过使用两个日期选择器(开始日期和结束日期)来完成同样的事情,但我的老板希望这种过渡对最终用户来说尽可能无缝。

我的表单上有一个 sle_date_shipped,目前采用 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, '~'))

-保罗霍兰-