Questions tagged [substring]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
36 views

Limit string character limit to 250

I want to check the size of a string. If the size is greater than 255 characters, then reduce it to 252 and add three dots towards the end. For example. String1 = 'Suppose this is 255 characters'; ...
Goat123's user avatar
0 votes
1 answer
873 views

Extract specific string in between 2 characters using Salesforce formula

I want to extract the time in this below chat transcript body field. Below is the sample value in Chat Transcript Body field : And I want to take the value 13s <p align="center">Chat ...
sThirumagal93's user avatar
0 votes
1 answer
135 views

Ampscript code to cut part from string

I created a code to take the utm and cut it specifically in the campaign part of the utm and return only it. this code works as long as the utm campaign comes first. But I also need to consider that ...
Mikael Oliveira's user avatar
1 vote
1 answer
128 views

Modify then concatenate String

I have an Email Service that creates Leads from 3rd party vendors. We now want to accept a UTM parameter, but the vendor can’t concatenate. In my class, how can I turn this (which is in the body of ...
Cory O. Bennett's user avatar
0 votes
2 answers
336 views

Substring Ampscript extracting url within quotes

We have a use case where we’re pulling in a url from Salesforce CRM which contains the entire A tag. We’re looking to use Substring but can’t pull in the end of the URL before the quote. “” target=” ...
TimZ's user avatar
  • 158
-2 votes
1 answer
6k views

What does the .substring(3) function do? [closed]

See I'm getting this field from an integration with wooki, and the field should go to Salesforce in currency format. I get it with the following value: BRL 20.000,00 (Twenty thousand reais)I need to ...
Souza's user avatar
  • 305
0 votes
1 answer
848 views

SubstringBefore move to the next symbol appearance

I want to substring string by some symbol and move to the next appearance of that symbol on some condition. So in that code i want to skip 'Skip' subsrting and move to the next. UPD: i need to split ...
Gilivan's user avatar
0 votes
1 answer
946 views

Split the string from right side to get the required output after second occurrence of special character

I have requirement to get the string by splitting right side Ex 1.abc-sgd-ajj-test output needs to be in string = abc-sgd test-string-split-exam-demo output needs to be in string = test-string-...
Sandy's user avatar
  • 7
1 vote
2 answers
1k views

Salesforce regular expression get id value from string from prefix and Name of the record

I am trying to parse the string to get the Record name which is auto number D-{0000} format (ex: D-345677) and record id which is 15 to 18 char length which prefix starts with(a7s7) and full id is '...
bharath's user avatar
  • 1,714
0 votes
1 answer
1k views

lightning controller get string value

using substringAfter and substringBefore in lightning component controller but string value i am not able to get and it is throwing an error that substringAfter and substringBefore is not a method. ...
cloudZigZag's user avatar
  • 1,366
1 vote
2 answers
5k views

Replace character in string in specific position (ie not first, not all)

I would like to replace one character in a string with an uppercase of the same character. Is there an elegant way to do this? Eg I have 'Donald Mcdonald' and I would like to uppercase the first 'd' ...
Irene's user avatar
  • 1,769
-1 votes
1 answer
5k views

Substring in LWC Javascript [closed]

How can we use substring in LWC. I have a input tag, onclick of that input tag i am getting the event.target.name. however i am not getting the substring output in LWC. i do not get the last console....
Umesh Rathi's user avatar
2 votes
2 answers
157 views

Can you combine substring and indexOfChar in the same line?

I have an HTTPResonse that when you get the body looks like this: {"id":"/Project/34rxq38ntgrvxj7vkzqj8xe7v68"} I want to get the Id from it to use later and I'm having trouble figuring out how ...
Dan Wooding's user avatar
  • 3,498
1 vote
1 answer
26 views

How do I remove repeating parts?

I'm trying to remove a substring with \n + random dateTime value + created date time.. My code works, but I want to make it prettier. How do I remove repeating parts by different conditions? If it's ...
Apelsinova's user avatar
3 votes
1 answer
3k views

Extract all occurences of a substring from a string

hello guys how would i extract all instances of a substring pattern given a string. e.g given a string templateContent = 'hello adrian , this is for {!Contact.Name} to be delivered to {!Account....
Soji's user avatar
  • 109
1 vote
1 answer
2k views

System.StringException: Ending position out of bounds:

I am getting the titled error System.StringException: Ending position out of bounds:99 for the below code: CusObj2.ProdName__c=CusObj2.Name__c.substring(0,99); All I want to do is truncate the ...
jaw999's user avatar
  • 1,307
1 vote
1 answer
106 views

Is it possible to remove of filter keysets by a standard method and only maintain keyset which start with a string

I query over Custom metadata to get 1 record(settings) with custom fields "MdtFieldsAcc" I pass the fields in a map with .getPopulatedFieldsAsMap() and then currently remove 1 keyset (Id). Is there a ...
Thomas's user avatar
  • 2,294
1 vote
1 answer
646 views

Ending position out of bounds: 10

I am trying to get the first 10 characters from "Patient_Name__c" field into the "Patient_Id_Help__c" field but when i run the batch class it is throwing the error as "Ending position out of bounds: ...
Dinesh Prasad's user avatar
0 votes
1 answer
82 views

How to fetch the values from the String to store in a seprate string upto certain part

Hi I need to store the certain part of the string and store it in a separate integer variable. My Final string getResult = {"httpStatus":200,"httpRequestUri":"/sfsImagingservices/documents/followup/...
Raghav's user avatar
  • 3
0 votes
1 answer
547 views

AMPScript SubString Adding in Additional Character

I am trying to work out a way to personalize emails whereby I utilize the "Full Name" field but parse the data after the first space. I am having issues with my AMPScript for this block: %%[ SET @...
user68909's user avatar
0 votes
1 answer
426 views

Removing characters from data extension field via AMPScript

A field used in a sendable data extension contains a value that I'm trying to remove the beginning characters from then add the remaining characters to the end of a different URL. Example: Data ...
Dave's user avatar
  • 191
1 vote
1 answer
4k views

How Can I Get A Substring From A Long Text Area Field?

I have a Description field of type Long Text Area. I'm trying to get the first few lines to display. 1. I tried creating a formula field LEFT(Description, 500) I get Error: You referenced an ...
Laura Bejjani's user avatar
2 votes
1 answer
120 views

substring assignment to limit data to custom field

I have a custom object with a custom field Message__c designed to hold 4000 characters. However, the getBody in rare circumstances has exceeded the 4000 character limit and caused an error. I have ...
Daryn's user avatar
  • 251
2 votes
1 answer
4k views

How do I check if substring is out of bounds?

I'm trying to find a way to check if a substring causes an out of bounds error in an If statement This is what I have got so far but if the original string has less than 8 characters after substring ...
ridwan's user avatar
  • 67
0 votes
1 answer
884 views

Replace substring with masking character in Visualforce

How do I replace a substring with a masking character in Visualforce? For eg. I have a list of Contacts under an Account to be displayed on the Visualforce page - email field to be masked. username@...
yeselkay's user avatar
  • 321
0 votes
1 answer
1k views

Check For Special Characters in Emails

I'm having a business requirement of searching special characters in Email Field(before @domain.com)in a trigger. For Ex: if a email is like this (t#@[email protected]).it should be able to identify the'#...
Rishi's user avatar
  • 25
1 vote
2 answers
350 views

Error on Apex Trigger when trying to use "substringAfter(' ')"

I started this issue in another post but figured I'd separate it so that I could go into further detail here. I'm attempting to remove the city that is after the space. As an example the variable is ...
Nathan White's user avatar
0 votes
1 answer
406 views

How to update record values through email body

I have a requirement to create case for specific subject email.I wrote an email service working well. But now i try to capture some values from email body and need to updatein specific field. Like ...
Pavan tej's user avatar
  • 1,450
1 vote
1 answer
3k views

Can I use Ampscript to remove the last character from a URL?

I am attempting to remove the last character from a URL string. Can I achieve this using Ampscript? It seems like it might be possible using lenght() and substring() and subtract() but I can't seem ...
IR15's user avatar
  • 13
1 vote
1 answer
1k views

trim namefield from right in SOQL

How can I trim a namefield from right and have only last n Characters. I only found examples from left. I have the following SOQL where I tried this: [select Name, Body, BodyLength from Attachment ...
Jenssen's user avatar
  • 419
1 vote
2 answers
59 views

Using IF Substring to change link or image based on the market the email goes to

I am currently using in email to call an image or link based on needs. %%[IF Substring(ISO_CNTRY_2_CD,1,2) == "US" THEN]%% <br><br>US<br><br> %%[ELSE]%% <br><br>CA&...
Leon's user avatar
  • 11
0 votes
1 answer
209 views

Capture everything but the last 3 digits

I need to capture the value of a number without the digits. Let's say I need only 17 from 17,873. The number can also be without comma, like 17873. How can I do that with AMPscript substring? A round ...
Snowalker's user avatar
  • 369
2 votes
3 answers
5k views

Check If String Starts With Any Of A Set<String>?

This is basically what I'm trying to accomplish: I have a Set of strings, for example: Set<String> emails = new Set<String>{'abuse@','database@','fbl@','ftp@'}; I also have a list of ...
The Ghost's user avatar
  • 245
0 votes
1 answer
381 views

Replace double character with single in string

I have to replace double semicolon (;;) in a string with single comma(,) in an apex class. Can someone help me?
Testing_SFDC's user avatar
  • 2,940
0 votes
1 answer
1k views

get specific value from string based on separator

I have a code String[] base = new String[]{'my father | name is | bryan luke','my mother | go to | shopping mall'}; for(integer i=0; i < base.size(); i++) { String output = base[i]; ...
Vikolai's user avatar
  • 67
0 votes
2 answers
1k views

how to get the value of string based on my separator

I need to get this string before my separator, in this case a pipe character ('|'). So if I have this data: Malcolm Bell Landgraab | EMP-00012 | Consultant Juliawati Sandra | EMP-00003 | Consultant ...
Vikolai's user avatar
  • 67
1 vote
1 answer
1k views

Substring for a specific value

I have below string value from which I need a specific section to put in another string. Can someone please help? String [{"attributes":{"type":"Call2_vod__c","url":"/services/data/v37.0/sobjects/...
Testing_SFDC's user avatar
  • 2,940