首页 > 代码库 > 空格改为下划线的两种方式

空格改为下划线的两种方式

 1 for i in Geometry do 2 ( 3     x=i.name 4     for fe = 1 to x.count do 5     ( 6         if x[fe]==" " do 7         ( 8             x[fe]="_" 9         )10     )11     i.name=x12 )
View Code
 1 for i in Geometry do 2 ( 3     ThenObjNameCount=i.name.count 4     for Fe=1 to ThenObjNameCount do 5     ( 6         try 7         ( 8             ThenObjName=i.name 9             NameID=findstring ThenObjName " "10             if NameID !=undefined do11             (12                 NewName= replace ThenObjName NameID 1 "_"13                 i.name=NewName14             )15         )catch()16     )17 )
View Code

 

空格改为下划线的两种方式