Skip to main content
added 6 characters in body
Source Link
Pranay Jaiswal
  • 36.4k
  • 17
  • 79
  • 138

I have a list of string something like below

String roleId=105775004,105789004,105809004,105816004,105826004,105844004,105850004,105852004,105863004,105939004,105944004,105953004,105960004,105975004,105985004,106025004,106035004,106056004,106080004,106107004,106110004,106115004,106130004,106148004,106152004,106171004,106172004,105357004,105370004,105375004,105378004,105394004,105401004,105402004,105405004,105415004,105416004,105437004,105444004,105464004,105475004,105493004,105503004,105523004,105533004,105555004,105563004,105574004,105583004,105587004,105594004,73148004,73194004,73196004,73197004,73403004,74319004,74505004,75089004,75248004,75450004,75452004,75668004,76238004,76256004,76381004,76499004,77224004,78985004,79195004,79512004,81467004,81866004,82140004,82269004,82346004,82529004,82804004,82961004,82969004,82974004,82984004,83156004,83532004,83685004,8375700

String roleId=105775004,105789004,105809004,105816004,105826004,105844004,105850004,105852004,105863004,105939004,105944004,105953004,105960004,105975004,105985004,106025004,106035004,106056004,106080004,106107004,106110004,106115004,106130004,106148004,106152004,106171004,106172004,105357004,105370004,105375004,105378004,105394004,105401004,105402004,105405004,105415004,105416004,105437004,105444004,105464004,105475004,105493004,105503004,105523004,105533004,105555004,105563004,105574004,105583004,105587004,105594004,73148004,73194004,73196004,73197004,73403004,74319004,74505004,75089004,75248004,75450004,75452004,75668004,76238004,76256004,76381004,76499004,77224004,78985004,79195004,79512004,81467004,81866004,82140004,82269004,82346004,82529004,82804004,82961004,82969004,82974004,82984004,83156004,83532004,83685004,8375700 ii want to divide into every 20 string to pass as input query params for my api call ?.How would i do that ? Thanks in Advance.

            Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('http://api.json.com/rest/test.json?&method=getbyQuery&id='+roleId);
        request.setMethod('GET');
        request.setTimeout(120000);
        request.setHeader('Content-Type','application/json'); 
        HttpResponse response = http.send(request);
        
        if (response.getStatusCode() == 200)
        {
        }

I have a list of string something like below

String roleId=105775004,105789004,105809004,105816004,105826004,105844004,105850004,105852004,105863004,105939004,105944004,105953004,105960004,105975004,105985004,106025004,106035004,106056004,106080004,106107004,106110004,106115004,106130004,106148004,106152004,106171004,106172004,105357004,105370004,105375004,105378004,105394004,105401004,105402004,105405004,105415004,105416004,105437004,105444004,105464004,105475004,105493004,105503004,105523004,105533004,105555004,105563004,105574004,105583004,105587004,105594004,73148004,73194004,73196004,73197004,73403004,74319004,74505004,75089004,75248004,75450004,75452004,75668004,76238004,76256004,76381004,76499004,77224004,78985004,79195004,79512004,81467004,81866004,82140004,82269004,82346004,82529004,82804004,82961004,82969004,82974004,82984004,83156004,83532004,83685004,8375700 i want to divide into every 20 string to pass as input query params for my api call ?.How would i do that ? Thanks in Advance.

            Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('http://api.json.com/rest/test.json?&method=getbyQuery&id='+roleId);
        request.setMethod('GET');
        request.setTimeout(120000);
        request.setHeader('Content-Type','application/json'); 
        HttpResponse response = http.send(request);
        
        if (response.getStatusCode() == 200)
        {
        }

I have a list of string something like below

String roleId=105775004,105789004,105809004,105816004,105826004,105844004,105850004,105852004,105863004,105939004,105944004,105953004,105960004,105975004,105985004,106025004,106035004,106056004,106080004,106107004,106110004,106115004,106130004,106148004,106152004,106171004,106172004,105357004,105370004,105375004,105378004,105394004,105401004,105402004,105405004,105415004,105416004,105437004,105444004,105464004,105475004,105493004,105503004,105523004,105533004,105555004,105563004,105574004,105583004,105587004,105594004,73148004,73194004,73196004,73197004,73403004,74319004,74505004,75089004,75248004,75450004,75452004,75668004,76238004,76256004,76381004,76499004,77224004,78985004,79195004,79512004,81467004,81866004,82140004,82269004,82346004,82529004,82804004,82961004,82969004,82974004,82984004,83156004,83532004,83685004,8375700

i want to divide into every 20 string to pass as input query params for my api call ?.How would i do that ? Thanks in Advance.

            Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('http://api.json.com/rest/test.json?&method=getbyQuery&id='+roleId);
        request.setMethod('GET');
        request.setTimeout(120000);
        request.setHeader('Content-Type','application/json'); 
        HttpResponse response = http.send(request);
        
        if (response.getStatusCode() == 200)
        {
        }
deleted 81 characters in body
Source Link

I have a list of string something like below

String roleId=105775004,105789004,105809004,105816004,105826004,105844004,105850004,105852004,105863004,105939004,105944004,105953004,105960004,105975004,105985004,106025004,106035004,106056004,106080004,106107004,106110004,106115004,106130004,106148004,106152004,106171004,106172004,105357004,105370004,105375004,105378004,105394004,105401004,105402004,105405004,105415004,105416004,105437004,105444004,105464004,105475004,105493004,105503004,105523004,105533004,105555004,105563004,105574004,105583004,105587004,105594004,73148004,73194004,73196004,73197004,73403004,74319004,74505004,75089004,75248004,75450004,75452004,75668004,76238004,76256004,76381004,76499004,77224004,78985004,79195004,79512004,81467004,81866004,82140004,82269004,82346004,82529004,82804004,82961004,82969004,82974004,82984004,83156004,83532004,83685004,8375700 i want to divide into every 20 string to pass as input query params for my api call ?.How would i do that ? Thanks in Advance.

            Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('http://api.json.com/rest/test.json?&method=getbyQuery&id='+roleId);
        request.setMethod('GET');
        request.setTimeout(120000);
        request.setHeader('Content-Type','application/json'); 
        HttpResponse response = http.send(request);
        List<ProjectRoleClass> projectRoles = new List<ProjectRoleClass>();
        
        if (response.getStatusCode() == 200)
        {
        }

I have a list of string something like below

String roleId=105775004,105789004,105809004,105816004,105826004,105844004,105850004,105852004,105863004,105939004,105944004,105953004,105960004,105975004,105985004,106025004,106035004,106056004,106080004,106107004,106110004,106115004,106130004,106148004,106152004,106171004,106172004,105357004,105370004,105375004,105378004,105394004,105401004,105402004,105405004,105415004,105416004,105437004,105444004,105464004,105475004,105493004,105503004,105523004,105533004,105555004,105563004,105574004,105583004,105587004,105594004,73148004,73194004,73196004,73197004,73403004,74319004,74505004,75089004,75248004,75450004,75452004,75668004,76238004,76256004,76381004,76499004,77224004,78985004,79195004,79512004,81467004,81866004,82140004,82269004,82346004,82529004,82804004,82961004,82969004,82974004,82984004,83156004,83532004,83685004,8375700 i want to divide into every 20 string to pass as input query params for my api call ?.How would i do that ? Thanks in Advance.

            Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('http://api.json.com/rest/test.json?&method=getbyQuery&id='+roleId);
        request.setMethod('GET');
        request.setTimeout(120000);
        request.setHeader('Content-Type','application/json'); 
        HttpResponse response = http.send(request);
        List<ProjectRoleClass> projectRoles = new List<ProjectRoleClass>();
        
        if (response.getStatusCode() == 200)
        {
        }

I have a list of string something like below

String roleId=105775004,105789004,105809004,105816004,105826004,105844004,105850004,105852004,105863004,105939004,105944004,105953004,105960004,105975004,105985004,106025004,106035004,106056004,106080004,106107004,106110004,106115004,106130004,106148004,106152004,106171004,106172004,105357004,105370004,105375004,105378004,105394004,105401004,105402004,105405004,105415004,105416004,105437004,105444004,105464004,105475004,105493004,105503004,105523004,105533004,105555004,105563004,105574004,105583004,105587004,105594004,73148004,73194004,73196004,73197004,73403004,74319004,74505004,75089004,75248004,75450004,75452004,75668004,76238004,76256004,76381004,76499004,77224004,78985004,79195004,79512004,81467004,81866004,82140004,82269004,82346004,82529004,82804004,82961004,82969004,82974004,82984004,83156004,83532004,83685004,8375700 i want to divide into every 20 string to pass as input query params for my api call ?.How would i do that ? Thanks in Advance.

            Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('http://api.json.com/rest/test.json?&method=getbyQuery&id='+roleId);
        request.setMethod('GET');
        request.setTimeout(120000);
        request.setHeader('Content-Type','application/json'); 
        HttpResponse response = http.send(request);
        
        if (response.getStatusCode() == 200)
        {
        }
Source Link

Apex-List of string divide into lists of n size

I have a list of string something like below

String roleId=105775004,105789004,105809004,105816004,105826004,105844004,105850004,105852004,105863004,105939004,105944004,105953004,105960004,105975004,105985004,106025004,106035004,106056004,106080004,106107004,106110004,106115004,106130004,106148004,106152004,106171004,106172004,105357004,105370004,105375004,105378004,105394004,105401004,105402004,105405004,105415004,105416004,105437004,105444004,105464004,105475004,105493004,105503004,105523004,105533004,105555004,105563004,105574004,105583004,105587004,105594004,73148004,73194004,73196004,73197004,73403004,74319004,74505004,75089004,75248004,75450004,75452004,75668004,76238004,76256004,76381004,76499004,77224004,78985004,79195004,79512004,81467004,81866004,82140004,82269004,82346004,82529004,82804004,82961004,82969004,82974004,82984004,83156004,83532004,83685004,8375700 i want to divide into every 20 string to pass as input query params for my api call ?.How would i do that ? Thanks in Advance.

            Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('http://api.json.com/rest/test.json?&method=getbyQuery&id='+roleId);
        request.setMethod('GET');
        request.setTimeout(120000);
        request.setHeader('Content-Type','application/json'); 
        HttpResponse response = http.send(request);
        List<ProjectRoleClass> projectRoles = new List<ProjectRoleClass>();
        
        if (response.getStatusCode() == 200)
        {
        }