Questions tagged [substring]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
41 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=” ...
user avatar
  • 113
-2 votes
1 answer
249 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 ...
user avatar
  • 255
0 votes
1 answer
87 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 ...
user avatar
0 votes
1 answer
292 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-...
user avatar
  • 7
1 vote
2 answers
588 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 '...
user avatar
  • 1,654
0 votes
1 answer
453 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. ...
user avatar
  • 1,298
1 vote
2 answers
2k 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' ...
user avatar
  • 1,397
-1 votes
1 answer
3k 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....
user avatar
2 votes
2 answers
108 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 ...
user avatar
  • 3,351
1 vote
1 answer
24 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 ...
user avatar
3 votes
1 answer
1k 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....
user avatar
  • 99
1 vote
1 answer
1k 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 ...
user avatar
  • 1,268
1 vote
1 answer
40 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 ...
user avatar
  • 2,116
1 vote
1 answer
349 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: ...
user avatar
0 votes
1 answer
59 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/...
user avatar
  • 3
0 votes
1 answer
237 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 @...
user avatar
0 votes
1 answer
226 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 ...
user avatar
  • 171
1 vote
1 answer
3k 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 ...
user avatar
2 votes
1 answer
66 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 ...
user avatar
  • 251
2 votes
1 answer
3k 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 ...
user avatar
  • 67
0 votes
1 answer
600 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@...
user avatar
  • 311
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#@est@gmail.com).it should be able to identify the'#...
user avatar
  • 25
1 vote
2 answers
235 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 ...
user avatar
0 votes
1 answer
363 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 ...
user avatar
  • 1,456
1 vote
1 answer
2k 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 ...
user avatar
  • 13
1 vote
1 answer
790 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 ...
user avatar
  • 419
1 vote
2 answers
39 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&...
user avatar
  • 11
0 votes
1 answer
135 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 ...
user avatar
  • 369
2 votes
3 answers
4k 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 ...
user avatar
  • 235
0 votes
1 answer
338 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?
user avatar
  • 2,900
0 votes
1 answer
975 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]; ...
user avatar
  • 67
0 votes
2 answers
646 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 ...
user avatar
  • 67
1 vote
1 answer
837 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/...
user avatar
  • 2,900