The tag has no usage guidance.

learn more… | top users | synonyms

1
vote
3answers
42 views

Apex : Count the number of letters in an arbitrary string

The String length() method return the total length of string but i need the count of characters Example if the string is 'm*tt-', the # of characters will be 3 even though the length of string is 5
0
votes
1answer
31 views

Text Wrap:Splitting of String at new line(\n)

I have following Data type Order_Description__c (Long Text Area(32768) ).We are trying to wrap this data type at new line characer. Input Data: Long text area as a Order_Description__c field is: ...
0
votes
0answers
29 views

Substring child field

I'm currently trying to substring a field of a child object in a formula to convert it to an integer and find the difference between several numbers in the field ([Lookup_Time__c].Time_name__c]). I ...
1
vote
3answers
171 views

Get Visualforce page Name in Apex controller

I want get current page name of visulforce page. I have tried this and it works for the page having no query parameters in the URL but it fails in the pages having one or more parameters. Any ...
1
vote
1answer
47 views

How to split String Using REGEXP or Using Pattern class

This is My String 14-Mar-16,RTRDTG78BGXPBE3H,D-Link DIR-600M Wireless N150 Home Router,10-Apr-16, SECEBH7HZMKZMG3B,Kaspersky Internet Security 2016 1 PC 1 Year I want to split this string Where ever ...
3
votes
1answer
56 views

String.leftPad(Integer, String) method not working as expected

So I have a bit of code that is supposed to pad strings of with zeros if they have a length of less than six in order to get them up to six. To accomplish this I've used the String.leftPad(Integer, ...
4
votes
3answers
300 views

Substring Error - Ending Position Out Of Bounds

I am trying to copy a Rich Text Field (32k) into multiple Rich Text Field (2k). I get this error: System.StringException: Ending position out of bounds:2000. Code trigger UpdateCaseResponse on ...
0
votes
1answer
24 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
167 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 ...
1
vote
1answer
34 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
93 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
39 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='...
7
votes
4answers
464 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: /apex/NewTripMeetingEntry?...
5
votes
1answer
44 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
61 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
35 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
335 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
114 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 = ',,,,,,,af,...
3
votes
2answers
79 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
25 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
94 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
48 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
32 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
79 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
27 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 if(!ccTo.contains(OneMap.get(mycontact.ID)....
0
votes
2answers
113 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
18 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 ...
3
votes
1answer
413 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
577 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: String....
0
votes
1answer
38 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
11
votes
4answers
9k 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
275 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> {!line....
1
vote
1answer
309 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
279 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
45 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
334 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
341 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
768 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
112 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
117 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
487 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 = '01/13/2015,01/20/2015,01/27/2015,02/03/...
8
votes
2answers
472 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
162 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
3k 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
139 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 = remainingStepsAsString.split('\\b'+...
0
votes
2answers
209 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'; Second__c='Nine,Four,Second,...
4
votes
1answer
446 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
3k 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'; System....
5
votes
1answer
118 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
135 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, String.replaceAll('\\<.*?\\>',...