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.

43 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
0answers
664 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");
3
votes
0answers
247 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)} {!...
3
votes
0answers
136 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, ...
2
votes
0answers
4k 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 ...
2
votes
1answer
192 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 ...
2
votes
1answer
1k 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 "...
1
vote
1answer
183 views

System.JSONException: Unexpected character ('i' (code 105)): was expecting comma to separate OBJECT entries at [line:1, column:18]

I'm trying to escape a string but I had no success so far. This is the response body: {"text":"this \"is something\" I wrote"} Please note that there are 2 backslashes ...
1
vote
0answers
99 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 ...
1
vote
0answers
51 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 ...
1
vote
0answers
635 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&:...
1
vote
1answer
100 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 ...
1
vote
0answers
817 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; ...
1
vote
0answers
205 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 ...
0
votes
0answers
26 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 ...
0
votes
1answer
16 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('...
0
votes
0answers
27 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 ...
0
votes
1answer
60 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....
0
votes
0answers
42 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 ...
0
votes
1answer
74 views

Empty String check not working

I am developing an Apex class which is making a webservice callout by supplying Account number as the request payload. If the Account is not found in the external system, the webservice is returning a ...
0
votes
0answers
443 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 ...
0
votes
1answer
305 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\...
0
votes
0answers
24 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(); ...
0
votes
0answers
188 views

Escaping HTML in JSON in rest callout

I am sending some html content inside json in the body of a REST callout from Salesforce to Dotdigital per their specs which is working well overall. string.escapeHTML4 is handling most of the ...
0
votes
1answer
33 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 ...
0
votes
0answers
235 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 ...
0
votes
1answer
222 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 " " .
0
votes
1answer
186 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>...
0
votes
0answers
25 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 ...
0
votes
1answer
49 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 ...
0
votes
0answers
34 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 ...
0
votes
0answers
162 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 ...
0
votes
0answers
45 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: &...
0
votes
0answers
61 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 ...
0
votes
1answer
52 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='...
0
votes
0answers
964 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 ...
0
votes
1answer
289 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 ...
0
votes
0answers
39 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 ...
0
votes
0answers
33 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 ...
0
votes
0answers
101 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.
0
votes
1answer
96 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. ...
-1
votes
1answer
25 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 ...
-3
votes
1answer
3k views

Pulling picklist options from a multi-value field

I am currently pulling select options for a multi-value picklist from a query which gathers field values from all of the child records from a certain __r relationship of an account. I would like to ...
-4
votes
1answer
1k views

How to escape html characters in long text area field

I have a requirement where i need to copy the contents of a contentnote to a longtextarea field called 'comments' using apex anonymous. The issue is i am getting the following HTML characters for ...