The tag has no usage guidance.

learn more… | top users | synonyms

0
votes
1answer
12 views

getting text within a string (similar to merge fields)

I am trying to do something similar in concept to merge fields, basically I want to extract the text that is within "my merge assignment (in the moment is {! the word i want }, but I could change to ...
2
votes
1answer
104 views

API JSON response too long to process

I am trying to process a string that is the result of an API call. Unfortunately the return value is a really long String (nearly 6 million characters, Length: 5468120), so when I am trying to do ...
0
votes
1answer
20 views

SOQL query to find a row with the longest string in a column

I was trying trying to figure out if there is a way in SOQL to select/sort rows in a table with the longest Strings in a selected column. Something similar to: SELECT Id, Name FROM User ORDER BY ...
2
votes
2answers
48 views

How to extract first 3 character from a name field [closed]

Is is possible to extract first 3 letters of last name using soql?
0
votes
1answer
36 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 ...
7
votes
4answers
453 views

String Value of ID returns more than ID

I have a visualforce page that I pass a related Event's id to the url to reference. I want to then push it into a field. the resulting UR of the page is for example: ...
5
votes
1answer
33 views

Please explain the replaceall method in the code below and how the output is not replace by $1

String x = 'The !shorn! sheep !sprang!.'; System.debug (x.replaceAll ('!(.*?)!', '$1')); The output is: The shorn sheep sprang.
1
vote
1answer
56 views

Apex Method Not Executing Inside Apex Class

I'm new to Apex and trying to make quick work of a problem I thought would be easy to solve. Essentially, on a button click from an account page, I'd like an Apex Class called that compares our ...
1
vote
1answer
20 views

Remove newline characters from address merge field

I'm using a merge field inside a piece of JavaScript Code. {!Lead.Street} However in some cases, the result can be an address with 2 lines, and the newline character (I suspect) is causing an ...
3
votes
2answers
131 views

How to split a string by the newline character in Apex?

I wonder if it's possible to use the apex public String[] split(String regExp) method to split a string by the newline characters. The string being a csv file created on the Windows platform. I ...
1
vote
3answers
73 views

Salesforce String class split method, unexpected List size. Is this a correct behaviour?

Input String str = ',,,,,,,af,afs,,,,,,,,,,,,,,,,,,'; List<String> strSplit = str.split(','); System.debug(strSplit.size()); Result USER_DEBUG|[5]|DEBUG|9 Input String str = ...
3
votes
2answers
40 views

How can I escape a double quotation mark in VisualForce context?

I am trying to process a string before displaying it in a visualforce page. What I need to do is remove any quotation marks in the text field before I use it to assemble a link path. The following ...
2
votes
1answer
22 views

containsNone() behaviour?

I have a string like this bla bla. In my class I have code like this: String str = 'bla bla'; system.debug(str.containsNone(', ')); //debug result FALSE system.debug(str.containsNone(',')); ...
-2
votes
1answer
65 views

Ending position out of bounds: 18

I have a Custom Edit button. When clicking the Edit it is showing the error as "Ending position out of bounds: 18" Below is the code for class.Thanks public with sharing class ...
-1
votes
1answer
40 views

String value from a field of custom Object List

Please let me know how can I put a field values in a string from below List. oIncs = [SELECT Id , Name , No_Of_Transactions_abv__c , OwnerId , ...
0
votes
1answer
24 views

add trailing values to the string

I have multiple currency/percent fields on which I need a method to add Zeros at the end. for example I have a currency(18,2) with value 4590, should end as 4590.00. percent(3,3) with value 3.3 ...
0
votes
1answer
52 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
26 views

Compare before putting values to List<String> [duplicate]

I have below piece of code that generates error as this: Method does not exist or incorrect signature: [List].contains(String) Error Line ...
0
votes
2answers
82 views

How to navigate multiple lists/maps and turn into string

I'm trying to populate a text field on Account with the Territory names of the account on insert or update (original territories, not Enterprise Territories or Territories2). I've mapped through ...
0
votes
0answers
17 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 ...
2
votes
1answer
274 views

Catch Regex too complicated when splitting a string in salesforce

I have created a function wherein I split a string from the csv filecsvAsString.split('\n') . It is working when the string is not so big. But when I try to split a very large string, an error will ...
1
vote
2answers
452 views

String.format escape curly braces

Is there a way to escape curly braces within String.format? E.g. if I want to get the following output: {777} I'd expected {{ would do the job but this code throws an exception: ...
0
votes
1answer
37 views

Split method truncating result and appending '…' in the end

String s = 'a b c d e f g h i j k l m'; System.debug(s.split('')); above code returns (, a, , b, , c, , d, , e, ...) am I missing something? Please help
10
votes
4answers
6k views

How to check in Apex if a Text field is blank

I'm unsure what's the shortest and most robust way to check whether a Text field is blank / empty? /*1*/ Boolean isBlank = record.txt_Field__c == ''; /*2*/ Boolean isBlank = record.txt_Field__c == ...
2
votes
1answer
229 views

apex:outputText remove LEFT

is there any possibility to use LEFT to remove first 5 characters of string? My records of UoM always have a first 5 chars as code, which I do not want o print out. <td> ...
1
vote
1answer
275 views

Find Alphanumeric characters in string & split by it

I need a method to split the string by alphanumeric characters, Example- String str = 'is this testing?yes it is.Please split the string, then use for further functionality.'; I need list of ...
2
votes
2answers
205 views

Email Parsing with apex class

Anybody having knowledge regarding the Email Parsing?? I have a requirement that i receive data from email and i need to split it. for ex: *Category : (Some Data) *Type : (Some Data) I need to ...
2
votes
1answer
44 views

Compare Strings is not working

I am comparing string variable with hardcoded ones but the value is returning false.Even I tried with equals() and its returns false. Here is the apex code String myadd =''; ...
1
vote
1answer
288 views

Check if a string substring value is alphabet

I have a requirement to make string values passed as init caps. How to check whether the element I am capitalizing by toUppercase() is an alphabet or not? Please find my code snippet here. Snippet: ...
1
vote
1answer
268 views

Difference between capitalize and to Uppercase()

I have a requirement to make a string value passed as initial caps. Can someone let me know what can be demerits using .capitalize method instead of substring the first position and convert it to ...
3
votes
1answer
637 views

problem replacing and splitting string

I am trying to replace a pipe character used as a delimiter in a string. The string comes back with the pipe as the html entity code like this: Unassigned&#124;Scheduled&#124;Tech on Site ...
0
votes
2answers
96 views

Substring is getting nullpointer exception

I have a map of contacts. Need to print substring of title. but it errors out, when title is null : System.NullPointerException: Attempt to de-reference a null object public class k { public ...
0
votes
1answer
91 views

How to snip and pass a string value between brackets to a Map?

I've been searching through past questions and other literature to try to figure this out but it's time to just ask outright. I'm trying to write an after insert trigger that takes the string value ...
0
votes
2answers
372 views

Split a long string into substrings till it is empty

I tried this code to convert a string into sub-strings until the original string do not empty. Please guide where I'm wrong in it? Thanks. String dates = ...
8
votes
2answers
368 views

replace characters while keeping original parts

Is there an easy and elegant way to add characters in a String at specified places around found characters? The way I started thinking was like this: String regExp = '[\\d]'; String toFormat = '1 ...
3
votes
2answers
141 views

String split function not working properly. Any suggestions please

I tried to split a string using the delimiter [.] and the list size after split is 3 which is wrong and it should be 9 which is wrong. How to get the correct list size? Why this happening? Any ...
2
votes
1answer
2k views

Checking fields for Blank or Null

I am building a CSV file from an sobject list in a batch class. There are certain fields that are appearing as "NULL". When I am checking them for NULL values using IsBlank , I am getting an error ...
3
votes
0answers
120 views

How can I use Pattern and Matcher instead of split() to do this?

I have the following function: @testVisible private String selectBeforeKeyword (String remainingStepsAsString, String keyword) { List<String> splitList = ...
0
votes
2answers
161 views

Check if there is any common string in Two List<String>, or in Picklists

I have two multiselect picklists Assume - First__c and Second__c I want to check if there is any common string between them e.g. First__c = 'First,Second,Third'; ...
4
votes
1answer
398 views

Evaluation issue with the String class endsWith() method

We've started encountering evaluation issues with the endsWith() method. We are using a multi-select field called, "Product_Notification__c", which we pull back and split into a string array for ...
4
votes
2answers
2k views

String method startsWith(String) is case-sensitive or not?

When i tried to run the following code snippet anonymously in dev console i got different boolean results. Is string method startsWith(String) case-sensitive or not? String s1 = 'Thomas Inc'; ...
5
votes
1answer
116 views

Phone to String Formula Field

Suppose I have Contact Record with FirstName, LastName and Phone, where in phone i am inserting my Mobile no. e.g. FirstName: ABC LastName : XYZ Phone : 9921125797 MyFormulaField ...
1
vote
1answer
121 views

I want to start new line after .(dot) symbol.

I'm copying data from RichText Area field to Text Area field,When I copied in Text area field,The data is displaying with HTML tags. So used below code to convert, ...
2
votes
1answer
948 views

Add blank space to a string in trigger

So I have a trigger that's working well - it looks at some multi-select fields on a Job object and then matches those to Accounts with the same values, pulling in the Account Manager's email address. ...
5
votes
1answer
3k views

Example of using String.format() with a number / does this function even work?

Per the docs format(String, List<String>) Treat the current string as a pattern that should be used for substitution in the same manner as apex:outputText. Which would lead me to ...
3
votes
1answer
585 views

Is there a simple way to convert any value direct to String in production code?

When I do a System.debug(whatever), SFDC doesn't care whether whatever is a String, a Date, a Datetime, a Boolean, etc... it just makes a string of it and dumps it in the log. But in the following ...
4
votes
1answer
279 views

How can I dynamically transverse SObject fields in Apex?

I am trying to dynamically create a CSV file from Case records. The fields for the CSV file will be determined in custom settings (and therefore shouldn't be hardcoded). Moreover, the fields may ...
6
votes
2answers
755 views

Sanitize a string before injecting it into SOSL

Is there a way through the .net framework or some other package to sanitize strings so that they can be safely used in sosl? Is there any larger standard that SOSL falls under? I was able to find How ...
0
votes
1answer
479 views

Replacing multiple consecutive spaces with Pipe character

I need to replace multiple consecutive spaces with pipe character ,I tried various regular expression but i couldn't get the output .Can anyone give me solution for this
3
votes
1answer
834 views

Transform JSON with lists inside into form data in Apex

Is it possible to serialize this JSON to Form-data in Apex? The JSON we received: [{"vendorcode":"4444","startDate":"2014-03-02","client":[{"name":"John"}]}] We need to serialize it to Form-Data, ...