The tag has no wiki summary.

learn more… | top users | synonyms

2
votes
1answer
27 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
57 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
1answer
32 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
82 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: ...
0
votes
0answers
35 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 ...
2
votes
1answer
133 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
28 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
18 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
63 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 = ...
6
votes
2answers
119 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
57 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
603 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
71 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
53 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
139 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
617 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
98 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
55 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
332 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. ...
4
votes
1answer
1k 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 ...
2
votes
1answer
52 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
179 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
374 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
258 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
2
votes
1answer
486 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, ...
5
votes
1answer
1k views

Lower case SOQL with 'IN' operator

I am trying to make a SOQL query trying to match email ids with lower case: SELECT Id, Custom_Email_Id from Custom_Object where Custom_Email_Id IN :list_of_email_ids Here, I am trying to get all ...
3
votes
1answer
5k views

Test string variable for “Blank or Empty” in an apex trigger

I have a variable that successfully holds the result from a query in a trigger. I am able to use this variable to update the Contact record. However; if the query does not return records the ...
2
votes
1answer
1k views

Method does not exist or incorrect signature: [Id].contains(String)?

Error Error: Autocompletefields Compile Error: Method does not exist or incorrect signature: [Id].contains(String) at line 20 column 21 public class Autocompletefields { public ...
1
vote
1answer
104 views

How to insert a string into another string?

I am having a string String S1="https://www.microsoft.com/s/5f5wpyvu1cbdek2ld3as" I am having another string String S2="0000000/demowidget". I want to insert my new string S2 into my old string S1 ...
4
votes
1answer
1k views

Email Template Replace merge field

I have an email template which uses merge fields from a custom object. For reasons difficult to explain here, I have to write my own code to read the body of the email template in Apex, replace merge ...
2
votes
2answers
807 views

Set default value for method inputs

How do you set a default value for a method input? public void myMethod(String input1, String input2); I would like to allow people to only need to state one of the inputs if they want (and have ...
3
votes
2answers
946 views

Formatting Negative Numbers with Parentheses

Formatting numbers on a VF page, but I do a bunch of processing the Apex Class, so I would rather return the formatted String value from the controller. I am doing something like this, but I just ...
1
vote
2answers
358 views

String.rightPad() is failing to include padding

I'm trying to ensure that a certain string var is always exactly 10 chars in length. String.rightPad() seems to be exactly what I need but it is not behaving as expected. Integer maxLen = 10; String ...
2
votes
2answers
145 views

Unable to save URL's as a list of string values

I'm not certain if once I've created a URL via a string, it needs to be treated as a WebLink in order to save it in a list, but every time I try to save a list of them as strings, I get an empty list. ...
2
votes
1answer
2k views

Problem using string replace method

I'm attempting to replace a portion of a large text area using the code below without success. Have I misunderstood the proper usage of the string replace method, and if so, is there another ...
2
votes
0answers
86 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, ...
3
votes
1answer
1k views

Curious string comparison issue when string starts with a dash

Try the following example in an anonymous Apex window: String s = '- Default - '; system.debug(s.CompareTo('Banner')<0); // True system.debug(s<'Banner'); // False s = '/ Default -'; ...
7
votes
3answers
1k views

Unable to use multiline with pattern

I'm trying to match a string with Pattern/Matcher, however it is failing because I cannot set Pattern.MULTILINE like the Java documentation uses. String testString = 'Line 1: Does not match\nCustomer ...
-2
votes
1answer
1k 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 ...
2
votes
1answer
1k views

Replace text in Rich text area field with trigger

We're using the "Solutions" standard object as our knowledge base, with "Solution details" standard field is a Rich Text Area field (32000 characters). The field structure looks like this: Purpose ...
2
votes
2answers
615 views

Extracting number values in a text field then summing up

I have this field that gets populated by an external service and I want to extract the number values from it then sum the numbers up. For instance, see the text below United Kingdom: 3, Ireland: 1, ...
19
votes
1answer
6k views

Bug in String.split('.')?

I can hardly believe it but split() doesn't work on the . character: String createDate = '01.2.2013'; String[] cd = createDate.split('.'); System.assertEquals(3, cd.size()); // Boom! Tried with ...
5
votes
1answer
1k views

I need a String method in a Trigger to validate if a Rich Text Area is blank

I need assistance in evaluating whether a Rich Text Area custom field is blank using an Apex trigger. Rich Text Field name: Application_Workaround__c I have tried the following within the context ...
3
votes
1answer
814 views

Using RegEx Pattern Match to create DateTime fields in trigger

How do I write code with the correct syntax to run a pattern grouping match within a string, then replace the pattern groups found in the result so that they follow a desired pattern? I've never done ...
7
votes
2answers
330 views

Case sensitive highlighting of keywords

we have a rich text field in one of our objects that contains an html-document. I have created a search page and a user can click on a 'preview'-button which opens the html in a lightbox. I want to ...
0
votes
3answers
1k views

Comparing IDs - use String or don't use Strings

I have some logic where I need to iterate thru a bunch of Opportunities. I need to be able to determine when I hit a new Opportunity Owner ID. I try: String lastownerId = ''; for (Opportunity ...
10
votes
2answers
3k views

How do I do a case-insensitive replace all for a string?

I've got a project where I'd like to replicate some of the internal merge field functionality so users can build a link and it'd be really helpful if I could do a case-insensitive string replaceAll. ...
5
votes
1answer
3k views

How can I call a method from visualforce?

You would think this would be more obvious, but "how can I call a method from a visualforce page?" Say I have something like this: <apex:page controller="PreChatController "> <script> ...
2
votes
3answers
1k views

Encode Long Text Area field

I am working on some code that retrieves certain cases and then emails those cases as a csv. This is working to some extent. The problem I have is that one of the fields is 'Description' which is a ...
2
votes
1answer
731 views

New string methods substring Before/After, etc

I'm playing with the new string toys. I'm getting something out of a CSV (and I have very good reason to need to do that). I tried this: contents = contents.substringAfter('/n') and it's not finding ...