Skip to main content

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.

53 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3 votes
0 answers
1k views

What method can be used rather of "getBytes()" in salesforce, this method basically changes string to byte

Below is code snippet from C# which needs to be converted in Apex: var key = Encoding.UTF8.GetBytes("string");
anurag soni's user avatar
3 votes
0 answers
337 views

Why is an empty apex:attribute neither null nor blank but still an empty string?

Consider this simple component: <apex:component access="public" layout="none"> <apex:attribute name="myString" type="String" /> {!ISNULL(myString)} {!ISBLANK(myString)} {!...
Semmel's user avatar
  • 2,551
3 votes
0 answers
6k views

How could I do line breaks (/n or /r/n) on Messaging.SingleEmailMessage PlainTextBody?

I know this question is asked before and could found in the below links, (I am posting this as I want to post my code with some changes to the solutions provided in the below links.) PlainText email ...
Hasantha's user avatar
  • 2,055
3 votes
0 answers
163 views

Email 2 case comment - how to remove the original email

I'm creating a case comment from an inbound email. The created comment already contains the original email (see below). test reply 2 On Wed, Jun 19, 2013 at 10:12 AM, Support wrote: Dear itay, ...
Itay B's user avatar
  • 703
2 votes
1 answer
346 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
2 votes
1 answer
298 views

Best way to parse "stringified" (sub-)Map<String,String>

In my Auth Provider RegistrationHandler, I received an instance of the Auth.UserData class, filled with users data (in this case it is an external Salesforce user). The usage is very comfortable, as ...
nisseknudsen's user avatar
2 votes
1 answer
2k views

regex too complicated error when using split function for less than 1M characters

I am working with an attachment in Salesforce. this is a text file with 7291 rows and each row has 94 columns. I am able to read this attachment record as "Attachment". I am also able to convert "...
apn's user avatar
  • 1,722
1 vote
0 answers
161 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
1 vote
0 answers
302 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
  • 287
1 vote
0 answers
895 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
0 answers
439 views

setting a large http body

I am trying to send a http request with a large string Body; however, salesforce complaints about the size of the string, the error as follows: caused by: System.StringException: String length ...
Cuban coffee's user avatar
  • 1,606
1 vote
0 answers
60 views

ԥ character (Pe with descender) not working in soql where clause

We have a scenario wherein we receive characters like ԄԪԥñ¿¡ from a API. We then query on a object which has a field value equal to the response. It works for most of the languages but for some ...
Rohit's user avatar
  • 2,171
1 vote
0 answers
764 views

Lightning iframe URL with & sign

I just want to create a simple iframe: <aura:application implements="forceCommunity:availableForAllPageTypes" access="global"> <iframe src="https://myURL.com/views/S28/ALL?:embed=y&:...
MicroSumol's user avatar
1 vote
1 answer
157 views

Find string in a field, find account with same first and last name like that string and add that entire field to activity history field

Here's the problem: Every time a contact gets updated, I need to go to Notes&Attachments of that contact and fetch JUST the first line of the BODY field for every individual entry if it ...
Jurica Dujmović's user avatar
1 vote
0 answers
878 views

Invalid date/time error

Following piece of code is throwing an error: System.TypeException: Invalid date/time: 04/07/2016 02:00 PM if (t.activitydate != null) { DateTime activityDate = t.activitydate; ...
user569925's user avatar
  • 1,189
1 vote
0 answers
250 views

Apex - One extra character in string variable problem

I have recently stumbled upon a rather interesting problem on my end. I have set up an integration with external system, and it responds me with a Base64 encoded Hex code of a PDF document whenever I ...
TSunar's user avatar
  • 197
1 vote
0 answers
231 views

In a report how do I add a filter of type String having comma seprated values e.g. 'Cats,Dogs'?

Salesforce considers 'Cats,Dogs' as 'Cats' or 'Dogs'. This link suggest putting the string value inside double-quotes, which I've already tried without any success.
Aryansh04's user avatar
  • 280
0 votes
0 answers
30 views

Concat Multi Opps ID To One String

I'm newbie in this. I have an idea like this below: Example: I have a list Opp With 20 Close Won of only one user, I set up a flow (schedule) to scan all of its ID then input to "Send Email" ...
Thang HD's user avatar
0 votes
0 answers
22 views

Keep richtext codeblock identation and style to chatter feed item

Hi I'm trying to use a richtext in a lwc, in order to accept code snippets (String) denoted by triple single quotes like this: The lwc takes the richtext value and create a chatter feed item through ...
RProgrammer's user avatar
0 votes
2 answers
57 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
0 answers
113 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
0 votes
2 answers
4k 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
0 votes
1 answer
56 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
1 answer
873 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 ...
murkofeste's user avatar
0 votes
0 answers
257 views

I want to create a Text String in a Parent Object of Multiple Products sold on a specific Opportunity using a Formula Field - Help?

Parent Object - Opportunity Child Object - Opportunity Product I have a field for each product on the Opportunity. For example if Opportunity Products X and Y were added to the Opportunity as ...
kikalz's user avatar
  • 39
0 votes
1 answer
569 views

Replace Subject fields on Lightning Email Template

I'm having problems with replace() operations of text that I have in Subject of my Email Template. Subject is like: A - B - C My code is: EmailTemplate eTemplate = newEmail.searchForEmailTemplate('...
CPS's user avatar
  • 365
0 votes
0 answers
94 views

Why I cannot update the Account ID on this for loop?

for (Account acc : newAcc_lst) { System.debug('to15format Test 1-> ' + acc.id); Id to15convertString = acc.id; System.debug('to15format Test 2-> ' + to15convertString); String ...
CPS's user avatar
  • 365
0 votes
1 answer
358 views

how to concatenate lookup fields given certain circumstances

I finished up this batch but came across an unforeseen scenario and can't seem to figure out how to code in the case it occurs. Here is my current code: global class Batch implements Database....
verycold's user avatar
0 votes
0 answers
56 views

Help with changing a line on a list class in apex code

I am pretty new to coding and just need help on adding/changing the following line in my apex code so it queries the RecordTypeId as well as the OpportunityId from the record that my lightning ...
Sophia's user avatar
  • 35
0 votes
0 answers
1k views

Error escaping double quotes in large JSON string in Apex

I have large JSON response that I am trying to escape all instances of strings that are problematic for deserialization but am having some issues. Using .replaceAll works but that throws a "Regex too ...
626's user avatar
  • 273
0 votes
1 answer
984 views

CSV file string parsing by newline error

I'm trying to write unit tests. The unit tests have input of a stringed csv file. So I'm having csvFileDataAsString as the simulated input. String csvFileDataAsString = 'Column1,Column2,Column3\...
user2751691's user avatar
0 votes
0 answers
62 views

Merge string is not working to display PDF

I am using below code to merge two pdf into one page, Apex Class public String pdf { get { PageReference pg = new PageReference('/apex/demoVF'); Blob b = pg.getContentAsPDF(); ...
Nail David's user avatar
0 votes
1 answer
44 views

separation characters between picklists value - Set

I have 6 multi picklists. I pushed all the selected values into Set For Example: Picklist A: Cherry Apple Picklist B: Apricots Avocado Picklist C: Banana Blackberries Blackcurrant ...
Salvation's user avatar
  • 1,199
0 votes
0 answers
686 views

Unable to parse unicode characters as a string anymore

A few week ago, my api code that parsed a String just fine, all of the sudden doesn't work when the passed in string is unicode characters.. Here is my code: class Degree { String title; } class ...
BlondeSwan's user avatar
  • 1,098
0 votes
1 answer
633 views

how to ignore comma in string array in apex

I have this String Array [Burlington Textiles Weaving Plant Generator,Tim,Barr,"1,056.00",Burlington Textiles Corp of America]; How can I Ignore that Amount comma inside the " " .
Mukul Tijare's user avatar
0 votes
1 answer
523 views

replace function not working

Hi replaceAll function in apex, is not replacing every occurance in my string. Can anyone guide me on this, how to replace every occurrence in string? string body='<p>string 1</p><p>...
Vivian's user avatar
  • 21
0 votes
0 answers
29 views

Problems with displaying strings in layouts

I added a section to a standard layout in which I entered several fields. I have a string field in which spaces can not be inserted and the value can be very long (255 characters) the layout brings ...
Pericle Parquet's user avatar
0 votes
1 answer
51 views

Mysterious Repetition of Text in String

On a BeforeInsert and BeforeUpdate, per lead in a list, this code section loops through a map. Every time a value in the map matches some value on the lead, text is added to a string, including ...
Gabriel Rivera's user avatar
0 votes
0 answers
38 views

Reading Multiline Description Field and Adding Fields to a SQL Database Depending on the Description Field Values

Here's what I'm trying to do. Select Cases Where Status = New. Read the multiline Description field. Add the Case Id, Subject, Description to the database requests table. Depending on the Description ...
Laura Bejjani's user avatar
0 votes
0 answers
347 views

What is retString()?

I am reviewing some old code and came accross this line: List<String> segments = seg.retString(); seg has a value that's over 255 characters. When I run this method my output is empty ...
Olivia's user avatar
  • 3,471
0 votes
0 answers
75 views

breakline in string to pdf

I have an apex:component controller from where I pass a string to `</messaging:attachment <c:TrainersListComponent TrainingIdAttr="{!relatedTo.Training__c}" /> Which is rendered as PDF: &...
user42169's user avatar
  • 105
0 votes
0 answers
106 views

PageReference Keep Page Original Text Case (Upper and Lower)

This may be been asked before (I couldn't locate it), but given the below example. I need to create a url for a custom field, but the case changes. Is there a simple way around this to keep the ...
Andrew L.'s user avatar
  • 859
0 votes
1 answer
67 views

How to evaluate a string variable containing a suitable string inside the if()..else()?

I have a string variable called ifcondition which contains something like '24<25 && 'India'=='India''. I need to evaluate this into an if...else loop.How to do that. String ifcondition='...
Jyoti Zanwar's user avatar
0 votes
0 answers
1k views

Displaying a Lookup/Reference field type on a Visualforce page

I'm struggling to find this answer due to the ambiguity surrounding the many scenarios the keyword Reference can fit in to. I have multiple Reference types in my custom object. They are lookup ...
MattGarnett's user avatar
0 votes
1 answer
369 views

Send email to task owner through trigger and merge task field in email body

I need help. As per our requirment i have to send email to task owner if their task due date is passed and task is still open. I know that through workflow it is not achieveble. I have done a trick ...
Russel baker 1's user avatar
0 votes
0 answers
98 views

How to convert in a normal text a bold text from an email body of the EmailTo SFDC Feature?

I am trying to process a text from an email body that can contain text styled with bold or italic style. From the standard feature, Mail To Salesforce, I find this text in the description field of the ...
Endrit Sino's user avatar
0 votes
0 answers
36 views

Efficient, governor-aware string processing/validation in apex

I need to make sure that a string only contains ASCII characters and not any other character (e.g., from another alphabet). I need to run this in real-time on hundreds of text fields so performance is ...
Jorjani's user avatar
  • 2,232
0 votes
1 answer
162 views

String parse to Date yymmdd

I wrote a question below : String parse to Date yyyymmdd But now I'm facing a new similar question : What if I want to parse a string yymmdd to a date? for example : 190503 instead of 20190503. ...
Salvation's user avatar
  • 1,199
-1 votes
1 answer
747 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
-1 votes
1 answer
29 views

Preserve the String as it

This string is part of a JSON that I have. I am trying to store the JSON string that was generated using JSON.serialize method. Part of the JSONString has "default_value": "\" \"" as one of the JSON ...
SfdcBat's user avatar
  • 4,839