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.

36 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
0answers
338 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
201 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
127 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
3k 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
145 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
0answers
41 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
48 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
2answers
364 views

Generate random string using Crypto.generateAesKey?

I need to generate an unique alphanumeric string of length of 30 characters which will be used very similar to the record id. Is it okay to use Crypto.generateAesKey() method to generate this 30 ...
1
vote
0answers
540 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
99 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
743 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
158 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
1answer
40 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
16 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
85 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
23 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
55 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
96 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
69 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
24 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
48 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
32 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
104 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
43 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
53 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
48 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
757 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
249 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
33 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
31 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
99 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
51 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
570 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 ...