Thank you for supporting the Cloud Customer Connect Community in 2024. It's a gift to work with you!

Look back
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Extract numbers from string

edited Oct 6, 2020 5:02PM in Sales 3 comments

Summary

Extract numbers from string in groovy

Content

I have below type of string in my output response in groovy. I need to extract unique numbers from this string and store it in a List variable.How can that be done?

CONTENT1 PARTY_NUMBER||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||37470||44838||44838||44838||

Code Snippet

def GenericRequest_webKey="cs";
def GenericRequest =
[webKey:"cs",
Service:
[IdcService:"GET_FILE",
Document:
[
  Field:
[[name:"dID",
_text:"46655"
]],
],
],
]
def count = 0;
def Partynumber;
def List = [];

def wsresponse = adf.webServices.UCM_WebService.GenericSoapOperation(GenericRequest_webKey,GenericRequest)
def rec = wsresponse.Service[0].Document[0].File[0].Contents
def Rec1 = decodeBase64(rec)
def Rec2 = Rec1.replaceAll("\\s", "|");
println('CONTENT1  '+Rec2);

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!