Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

groovy - How to Extract only string using For-loop

How to Extract only string using For loop. For attached code: Expected Result: A0, A1, A2

Actual Result: null, A0, A1, A2

def s = new String[3] 
s[0]="A0" 
s[1]="A1" 
s[2]="A2"  

def myString 
for(def i=0; i<s.size(); i++){ 
  str = s[i] 
  myString = myString + ", " + str 
} 

log.info "Final String: " +myString
question from:https://stackoverflow.com/questions/65854833/how-to-extract-only-string-using-for-loop

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...