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
1 vote
1 answer
64 views

Within Governor Limits: Split a Large Text File Apart In Apex

I am writing a class that splits text file apart. Chunking them into 5000 line groupings so I can upload the files contents to another limited system. The text file contains a Json object on each line....
Ryan Sherry's user avatar
0 votes
1 answer
22 views

<lightning-formatted-rich-text> converting string to email formatting

I am currently writing a basic search users UI which can search email of users and return based on a search string and bolds the matching chars in the result. I achieve this by adding tags in JS and ...
Dillon P's user avatar
0 votes
1 answer
63 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
2 votes
1 answer
53 views

Inner class string passed to LWC being cut off

I have a custom lwc development that gets a configuration object from the backend via @wire decorator that is cutting off one of the response properties. { "cascadeMode": true, "...
molinet's user avatar
  • 915
0 votes
1 answer
92 views

HTTP Response data being Truncated

I am making a http request and getting response in JSON . When I am converting it to String using request.toString() but getting the truncated response response sample(This is the part of response ...
Sahil Gupta's user avatar
0 votes
2 answers
51 views

Unable to convert a particular string format to DateTime

I have the following dateTime values 2023-11-05 09:16:14 2023-11-07 09:16:14 Im getting them properly from a table using Apex code DateTime startDt = informaticaAuditTableRecords[0].startDate; ...
amitsingh6651's user avatar
0 votes
2 answers
118 views

String Manipulation

From a String of <Meaning>Equal</Meaning>, how can I extract only the word Equal to another string?I tried using methods subStringBefore() and subStringAfter(), but is there any other way? ...
Juny Yohannan's user avatar
0 votes
1 answer
122 views

Two strings that are seemingly equal, when compared with '==', return false, but why?

I have some pretty simple Apex code, something like this: private static final String X = 'ABC'; // String y is read from a CSV file. System.debug('<' + y + '>'); // Outputs: <ABC> ...
Sander de Jong's user avatar
-2 votes
2 answers
50 views

Stuck with a regular expresion

I have the following in Javascript and are trying to do this in apex but having issues .replace(/\s+/g, '-') // Replace spaces with - .replace(/&/g, '-and-') // Replace & with 'and' .replace(/[...
Thomas's user avatar
  • 2,294
0 votes
1 answer
81 views

How to insert predefined amount of blank spaces after a word

I have a situation where I need to export the data from salesforce object and generate the txt or csv file for our client to read and process.I can not use data loader beacuse file should be of a ...
SFDCDeveloper's user avatar
2 votes
2 answers
464 views

Is a Flow formula comparing strings for capitalization changes possible?

I have a flow automation that is triggered based on text changes in a few different fields. In cases of an update, we have some scenarios where users will change values in capitalization alone, from &...
sreeser's user avatar
  • 43
0 votes
2 answers
91 views

update fields in a records which is coming as a string

I am getting fields and its values in form of a string, for example: field1*Value1,Field2*Value2,Field3*Value3 I need to update above 3 fields in a record with their given values. Object ob=new object(...
Learner's user avatar
  • 21
-1 votes
1 answer
38 views

I'm trying to pull in multiple employees names based on who their manager is in an email in Marketing Cloud and can't figure it out

The manager is the recipient and they may have multiple employees that should be in the list below. I want to lookup manager email and then have the employee first and last name populate in ...
Sue's user avatar
  • 1
1 vote
1 answer
739 views

I need to convert a String to Blob within a Flow for the VersionData field on a ContentNote/ContentVersion type

I'm trying to insert a File (ContentVersion) or ContentNote with Rich Text within a Flow. But has anyone encountered the need to convert a string to a blob (base64 encoded type) in order to get a ...
rmarq423's user avatar
  • 967
0 votes
1 answer
117 views

parsing trough a JSON html string to obtain key-value pairs?

Im calling an API and after parsing trough the json this is the part I need: "description": "<b>Precipitating Event</b> updated from: to: testing update\n<b>Age</b&...
potato46's user avatar
0 votes
1 answer
115 views

converting DateTime to String returns the wrong Date as a String

I have the following code to get the DateTime for EST Time Zone Timezone tz = Timezone.getTimeZone('America/New_York'); DateTime now = Datetime.now(); Datetime localTime = now.addSeconds((tz.getOffset(...
potato46's user avatar
0 votes
0 answers
187 views

How to match Base URL in LWC with regex expression in JavaScript?

I have following two possibilities for Base URL - connect/X where X can be any of tankDetails, billingArrangements,foodsafetysolutions, quickList, orders, payments, insights, connectservices, ...
Amax1's user avatar
  • 109
2 votes
4 answers
3k views

REGEX in Salesforce Flow to retrieve a substring

I need to retrieve a substring from a text field in a flow. is it possible by using regex instead of apex ? If i try this regex i receive false as result ( boolean ), i should get true and then i ...
Brian23Gt's user avatar
  • 109
0 votes
1 answer
110 views

Write an invocable apex class to remove characters from a string

Fairly new to Apex so please bear with. I am trying to write a simple Apex Class that makes use of the replaceAll function to remove unnecessary characters from a string. I've got as far as the ...
Matt Stone's user avatar
0 votes
2 answers
277 views

String split on newline creates blank strings for every newline

I have a split on a newline which works fine, but it seems to create a blank value for every time it does a split, so 'MyText' contains the following values, separated by a newline: Blue Green Yellow ...
Irene's user avatar
  • 1,801
0 votes
1 answer
41 views

Having issues with handling text field

I have one requirement where text field have information like below format: String name = 'email,phone(Jason),mobile,address(Mason)'; Now what I want to do is create a Map<Key, List<String>&...
Sam Rickert's user avatar
2 votes
1 answer
216 views

Transform a List<String> for use in Multi-Select Picklist where clause

I have a list of strings which I need to put together in every valid combination so that the result can be used in an includes WHERE clause of a multi-select picklist in a SOQL query. Basically, I ...
Mike's user avatar
  • 1,199
0 votes
2 answers
262 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 ...
TechGuy's user avatar
  • 97
1 vote
2 answers
178 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 - ...
Felix Sanchez's user avatar
0 votes
1 answer
116 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
96 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 ...
Thais Carolyne Souza's user avatar
1 vote
0 answers
146 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 ...
PK SF's user avatar
  • 41
0 votes
0 answers
60 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 ...
PK SF's user avatar
  • 41
-2 votes
1 answer
61 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
81 views

How "String Split" method works?

How "String Split" method works for the below snippet? String emailAddress = '[email protected],[email protected],'; There is no value after the second comma. Even it will not throw any errors but ...
Deepanshu Rajta's user avatar
-1 votes
2 answers
116 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&...
user15754268's user avatar
0 votes
1 answer
473 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 ...
Mauricio Vilar's user avatar
1 vote
1 answer
131 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
1 vote
0 answers
242 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 ...
Lut's user avatar
  • 277
-1 votes
2 answers
55 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 "...
Hemant-2's user avatar
0 votes
1 answer
878 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 '...
Luke Bray's user avatar
  • 506
-1 votes
1 answer
665 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\"...
Willy Kelly's user avatar
0 votes
1 answer
798 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+...
MashaMasha's user avatar
0 votes
1 answer
257 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 ...
ambra2080's user avatar
-4 votes
2 answers
4k 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 ...
SalesforceKid's user avatar
-1 votes
1 answer
767 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": [ { ...
crazyDev's user avatar
0 votes
2 answers
3k 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","...
Noobie Dev's user avatar
4 votes
3 answers
858 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 ...
John Lewis's user avatar
0 votes
1 answer
48 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 ...
tr1v's user avatar
  • 29
0 votes
2 answers
6k 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/...
Olivia's user avatar
  • 3,461
0 votes
2 answers
1k 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 ...
sravanthi m's user avatar
-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
241 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' =...
Alex Barón's user avatar
1 vote
0 answers
746 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 ...
Bob McD's user avatar
  • 13
1 vote
1 answer
595 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....
Burak's user avatar
  • 135

1
2 3 4 5
10