几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   SolidWorks二次开发 (http://www.dimcax.com/hust/forumdisplay.php?f=111)
-   -   【转帖】if text not nil then (http://www.dimcax.com/hust/showthread.php?t=4508)

yang686526 2009-04-12 06:41 PM

【转帖】if text not nil then
 
if text not nil then...
i know nothing.
what i want to know is: if i have a piece of text that's blank (or is only a space), i want another piece of text to read the same unless the 1st, 2nd, 3rd etc. has a value in which case, i want the last case to be the value used:
eg.
txt1
txt2
(space)
(space)
output:
txt2
or...
txt1
txt2
(space)
txt3
output:
txt3
i know this is simple code that will end up in "custom properties" in a border (yes, i know it's redundant info).
any help is appreciated.
if i had a penny for every bug i've found... day...umm that's a buncha' copper...
dim arr() as string
const txt as string = "txt1,txt2, ,,txt3"
dim i as integer
arr = split(txt, ",")
for i = ubound(arr) to 0 step -1
if trim(arr(i)) <> "" then
exit for
end if
next i
msgbox arr(i)
quick


所有的时间均为北京时间。 现在的时间是 11:52 AM.