Questions tagged [string]

In computer programming, a string is traditionally a sequence of characters, either as a literal constant or as some kind of variable. In Apex it is considered as any set of characters surrounded by single quotes.

Filter by
Sorted by
Tagged with
0 votes
2 answers
32 views

Replace '{}' in Apex

Hello everybody I am passing a Json from javascript to an Apex controller to validate some info. The problem is that the json comes with some values like this: "Direction": {} And I want to ...
0 votes
1 answer
64 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 ...
1 vote
2 answers
120 views

String adjustment by identify position of last letter

I have these different versions of product IDs: Example 01: CA58762A090604 Example 02: X96017A096602 Example 03: CA61126D149403 Example 04: L00124B1154728 Let me break it up, it consists of Product - ...
0 votes
1 answer
29 views

ReplaceAll does not function Apex

Hello everybody I am managing data from a LWC form where the user inputs some data and I pass it to validate into an apex class. This validation manages the format of a date time value: I want the ...
user avatar
0 votes
0 answers
34 views

How do I put a DATE type value in a String field in a Marketing Cloud data extension

I'm trying to do this sql query, but I'm getting an error when converting the type date to string.... I've tried using CAST/ CONVERT/ TRYCAST .. but I must be doing something around because Marketing ...
1 vote
0 answers
21 views

problems with adding Child node to existing XML elements

I am trying to parse html in apex class using XML Parser Document and XML Nodes classes. At one point I need to add another xml which is present as string with me to one of the nodes as child node in ...
  • 41
0 votes
0 answers
54 views

Html Parsing in Apex Class [duplicate]

I have a html template file available as attachment in one of my Salesforce object. It contains a proper html form with input tags and sub templates. Whenever I get a request from third party, which ...
  • 41
-2 votes
1 answer
32 views

fill json with data

Hi everybody I am trying to do a LWC form where the user inputs some values and with them populates a json. So for example I have the lightning-input: <lightning-input type="text" label=&...
user avatar
-1 votes
1 answer
50 views

How "String Split" method works?

How "String Split" method works for the below snippet? String emailAddress = 'test@test.com,test1@test.com,'; There is no value after the second comma. Even it will not throw any errors but ...
-1 votes
2 answers
41 views

Extract data from string and reframe it into another

I have got a string in below format: String test = '11, -22|32.45, 34|32, 41|32, 12.12'; I am trying to convert it into below format: {"a":11,"b":-22|"a":32.45,"b&...
0 votes
1 answer
77 views

Its possible using elements in a Flow to edit a phone number? [closed]

Good day Salesforce Dev's! I have a question for you, hope you have the solution for this. Im implementing a Flow that fires when a record (account) is created. When the phone number is created, in ...
1 vote
1 answer
53 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 ...
1 vote
0 answers
64 views

SOQL returns no results when it should (:tempVar1)

When I run this query in my trigger (and similar on Workbench) Integer number_cdl = [SELECT count() FROM ContentDocumentLink WHERE ContentDocumentId = '0698c00000ArHhsAAF']; I get two records as ...
  • 267
0 votes
0 answers
74 views

Count # of Files related to an Opportunity (ContentDocument VS ContentDocumentLink)

I need to count the number of PDF files related with an Opportunity. Because DLRS dont allow to traverse across objects I had no other choice than to choose to write a trigger. I am novice when it ...
  • 267
-1 votes
2 answers
49 views

apex string processing [closed]

I have a requirement to replace specific text separated by a delimeter (delimeter can be , : ; etc). Example 1 : In string 'Sonu,krishna,Siva, pintoo' , need to replace specific token/text "...
0 votes
1 answer
406 views

How to pass ID array from LWC to Apex for VF page parameter

I have an array of Ids in a LWC that I need to pass to Apex. Here is my LWC function: import downloadPDF from '@salesforce/apex/PrintJobPDFController.getPdfFileAsBase64String'; import downloadjs from '...
  • 466
-1 votes
1 answer
207 views

Get a value from a string with If condition

I am trying to obtain a value from a string if something is true in the string, example: I have the following String String str1 = "{\n\"test1\": \"132456789\",\n\"...
0 votes
1 answer
223 views

How do I append something to a string until last character?

I'm asking how to append 3 types of strings (initial, middle and final) to each character of an input string example: "hello" -> I want to have: initialAppend+H+middleAppend+E+...
0 votes
1 answer
114 views

Marketing Cloud - SQL - Merge values from three columns into one [closed]

I'd need to bring together the values out of three existing columns (extract from a data warehouse) into a new column in order to create the required e-mail address. The e-email address as such is not ...
-4 votes
2 answers
803 views

How to check if string is null or not?

Is my below condition to compare the string is correct? I have data in all the 6 strings but still all my records are not going inside if loop. Is there any other way to check string null,blank ...
-1 votes
1 answer
250 views

Count number of values under specific JSON key [closed]

I have one JSON output which is parsed from String using JSONParser. Is there a way to check if key "dates" exists and number of values under "dates" in Apex? dates": [ { ...
0 votes
2 answers
2k views

JSON Array String into List

Sorry for this noob question but I just want to ask: String stringJSON = '[{"action":"ASSIGN","value":"Router"},{"action":"DISABLE","...
4 votes
3 answers
511 views

CPU Time consumed by Apex String comparison

I've found that certain string comparisons in Apex consume far more CPU time that would naturally be expected - specifically when at least one of the strings is very long ('long' here means over ...
0 votes
1 answer
34 views

Can't pull a string for apex:image

My client has a 'technical document' which shows you some data about their product, I created a button that gather these information and creates a page and it's all working fine. But depending on what ...
  • 29
0 votes
2 answers
2k views

Removing leading zeroes in Date String

I have checked a number of posts and regex examples but for some reason I can't get the leading 0's to be removed from the date string below. Can anyone see what I am doing wrong? wanted result: 4/6/...
  • 3,289
0 votes
2 answers
833 views

I want a trigger to change case status to close if it satisfies the conditions

I wrote a trigger to change case status to close if case is from specific email address and if the subject has a word from a list of word from custom label (Sub). I want the subject to be converted to ...
-2 votes
1 answer
2k 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 ...
  • 285
0 votes
1 answer
126 views

How can I generate arrays [...] to serialize an object? I want to make a simple JSON serialized

"Hello everyone". I have a couple of days with these json's. I have a json String done, like this: String payload = JSON.serialize( new Map<String, Object> { 'jsonrpc' =...
1 vote
0 answers
235 views

Replace whitespace in part of a string

I have cases which contain urls in the case description, and the urls contain whitespace. I need to replace the whitespace with %20 in order to make the links clickable from the case. Obviously the ...
  • 13
0 votes
1 answer
259 views

How can I send a really large string value to a method?

I have the following method that I am trying to test global static void updateLoggerError(String msg){ try { Logger.error(msg); }catch (Exception ex) { System....
  • 15
-2 votes
1 answer
110 views

How we can convert contentVersion Title to string ,i am getting some type casting error [closed]

Please help me where i am writing wrong.
0 votes
1 answer
22 views

Splitting E2C Source Email Addresses

I am currently trying to set a flow variable based on ToAddress value that comes in via an E2C situation. I realized that there are multiple email addresses being stored in that text field. Sometimes ...
  • 23
1 vote
1 answer
1k views

Remove text from String between characters which appear more than once

I have a String value from a Long Text field that contains Name/Email values. I need to extract only the names separated by a semi colon when there are multiple entries (no semi colon in the text if ...
  • 71
1 vote
1 answer
269 views

How to replace a SOQL query with a string?

Any idea how to convert a query into a string?
0 votes
1 answer
87 views

How to replace __c in a string?

I'm making a validator that returns an error. I'd like to show the user A good looking name like Missing Example Error instead of Missing Example_Error__c. Below is my code, yet it still prints ...
  • 139
4 votes
1 answer
284 views

char vs String in Apex

I'm currently working on creating a tiny expression language in Apex. I'm following https://craftinginterpreters.com which develops a simple lexer / parser in Java. I'm working on the lexer now ...
  • 473
0 votes
1 answer
118 views

How to handle validations from trigger to show as exception or toast on managed package layout

I currently have a custom pagelayout from a managed package. In this pagelayout a list of records can be selected to create new records for another object. I have a before apex trigger in which I want ...
  • 2,250
0 votes
1 answer
441 views

unescape String APEX

Premise: I have a list of string which I have to pass it from LWC to APEX and in APEX I have to put this List in SOQL where clause to get the data. Finally I have to return the SOQL result list back ...
  • 427
0 votes
1 answer
934 views

how to replace the value in SET in apex

I have a set in apex like this set<string> myset = new set<string>(); mySet.add('this'); mySet.add('is'); mySet.add('the'); mySet.add('example'); now i want to replace the value in the ...
  • 7
0 votes
2 answers
1k views

Escaping quotes in csv for Data Loader

I have a text field that can consist of a csv i.e. foo, bar, fizz, buzz. Using Data Loader, I had an issue where the csv would then think foo, bar, fizz, buzz was being split up into separate columns ...
0 votes
3 answers
159 views

Map or String: what do I have to use?

I need to create a method that receives three strings: color, brand and model. Would it be better to put a map that would receive for example ("color", "blue") or directly receive &...
  • 123
0 votes
1 answer
86 views

Match the substring in a string and append the substring with #tags

I have a string in that match the substring and append the substring with #tag like #Test#; String str = 'This is a TesT for reteSt the tEsTing which will confirm that test was not TEsTed perfectly by ...
0 votes
1 answer
205 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 ...
0 votes
1 answer
414 views

How to split csv string

I am using dataloader and retrieve data like that: "0017Q000003T1EdQAK","sForce ""Test"" ","Some,data","","94087","" ...
0 votes
1 answer
174 views

Replace escaped quotes

I want to replace all escaped quotes, but leave default quotes. How can i do it? string s1 = '"five1,five2", six ,seven,"eig\"ht1,eight2","nine",,eleven'; String ...
0 votes
2 answers
567 views

Apex string being truncated

I am passing a string that is hold the message to be sent to our endpoint from a trigger to a class and it seems if the string is over 270 characters it truncates field. I have not been able to find ...
0 votes
1 answer
565 views

Not able to remove substring that is variable from a string

I want to remove everything except for Name. removeStart() and remove() don't seem to take variable as a parameter. String tmpField = '{!Contract.Name}'; String child = 'Contract'; tmpField = ...
1 vote
1 answer
72 views

Get element from list which contains element from another list

I have two Lists with diffeerent lenghts and want to check this value. It must be something list that: List<String> first = new List<String>{'Test','Something'}; List<String> second =...
  • 41
0 votes
2 answers
66 views

Convert Task ActivityDate into String

I need in my wrapper class the activity date from the task object as string to display at a visual force page. My two version below does n't work. If I use this version I get an error (Attempt to de-...
  • 95
-2 votes
1 answer
48 views

CONTAINS("HP:H-P:NA.Co",Company) function returns true even if Company name is "-","NA" and "."

I need advice in writing Contains function while using the Formula field. CONTAINS("HP:H-P:NA.Co", Company) function should return true only if it matches the exact substring H-P or NA.Co ...

1
2 3 4 5
10