Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

-1
votes
1answer
21 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 ...
0
votes
1answer
25 views

Method does not exist or incorrect signature: void put(String, String) from the type Map<String,Map<String,String>>

Below code throws this error: Method does not exist or incorrect signature: void put(String, String) from the type Map<String,Map<String,String>> Code: //I have this map Map <...
3
votes
1answer
26 views

Syntax for a Unicode constant in Apex?

Let's say you wanted to create a String constant of a Unicode non-breaking whitespace. This is Unicode U+00A0 String nbsp = ????; The SFDC doc is maddeningly incomplete on this topic. The section on ...
2
votes
1answer
28 views

How can I correctly convert List<SObjectField> into a list of comma-separated field names to build a SOQL String?

I've created a generic selector class as follows: public inherited sharing class DAO_SObjectSelector { public List<SObject> selectFor(Query query) { return Database.query(query.toString()); ...
1
vote
1answer
50 views

Json attribute not showing in Marketing Cloud

I have a Json string and something does not make any sense to me. Here is the problem: I have a Json string with the following attributes in it: [{"MiddleName":"der","LastName":"Emmerzaal"},{"...
0
votes
1answer
21 views

Error in Json for Rest Api

I have a trigger that sends a certain opportunity to an unspecified stage, so I have a json with the objects, but I intend to send everything in a single string, so I joined json, when I run the code ...
0
votes
0answers
30 views

How to parse JSON String through apex [duplicate]

I want to get 'guid' and 'attachednotes'The attachedNodes is in different format. I think it is string array, but I am getting an error. { "messageHeader": { "triggeredBy": "manual", "...
0
votes
0answers
10 views

Null result on parent Account field [duplicate]

I would like to compare a field on the Opportunity to one on the Account to validate them. My string AccountClassif = o.Account.Account_Classification__c; is debugging as NULL when it has a value. ...
2
votes
3answers
730 views

Which is Better/Faster isEmpty() or isBlank()?

There is method, that have some condition flow and returning empty String ''(no space) in some case. Which method is more effective/faster to use in this case: String.isEmpty() or String.isBlack()?
3
votes
2answers
457 views

How to check if a string contains an element from a list

What is the best way to check if a string contains an element from a list? for example: String email= 'itairu@gmail.com' List<String> domainNames = split by ; from domains in a custom setting ...
0
votes
3answers
97 views

Remove the last characters in string [closed]

Can anyone help me how to get the id of the case on this string? String caseID = '500k000000gcuyciad&notify=1'; I dont want to include the &notify=1 or &notify=2 and so on
0
votes
4answers
81 views

Remove a character at a specified position in Apex

How can I remove a character at a specified position in Apex in String?
0
votes
1answer
25 views

Storing DateTime and Timezone in a Text field

We have a requirement in which we copy Event.StartDateTime in another field called Activity.Start_Date_Time_Text__c. The calculation of DateTime (UTC at rest) Text happens in before insert and update ...
-3
votes
1answer
49 views

Apex trigger, return string, calling methods and code correction needed

Please explain what is wrong as I have problems writing methods, and correct the code if you can. Error: Compile Error: Variable does not exist: a at line 11 column 16 trigger tokenGenerator on ...
0
votes
1answer
30 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
1answer
113 views

Invalid conversion from runtime type String to Double

Background I am getting this error: Invalid conversion from runtime type String to Double On this line of code: line.put(targetField, (Double)fieldValue); The variable fieldValue is of type ...
2
votes
1answer
625 views

Replace double quotes with single quote in a JSON string

We have JSON sent to us by webservice which has double quotes in value part (Key => Value)in the JSON String. Below is how the JSON looks like [{ "dp_id": "SDN071076", "list1": "...
0
votes
2answers
29 views

incrementing a number followed by a letter. eg A1, A2, A3 only. Under process builder formula field [closed]

I'm using the process builder for a certain task. Which will check a field of a record, if it's value is A1, it will create a new record and set it to A2, if A2 then set it to A3, and if A3 then ...
5
votes
3answers
281 views

JSON Parser getCurrentToken()

I have a JSON string that I want to parse out. I have use the below code many times but for whatever reason this time it is not working. Can anyone poke any holes in this logic? Or point out why this ...
1
vote
1answer
32 views

Only Start of Confirmed Built String Displays in Confirmation Popup Via Visualforce

With each inputCheckbox on my VF page checked, I'm adding to a string in my controller: public with sharing class ApplicationServerMonitorController { public String contactsAboutToEmail {get;set;...
1
vote
1answer
102 views

String starts with anything in a set<String>?

I want to see if any of the strings I pass(num) starts with any of the values on my set Ex. String num = 456987533; Set<String> numValidator = new Set<String>{‘456’,’312’,762’}; ...
1
vote
1answer
808 views

lightning component empty field check?

<aura:attribute name="guid" type="String" default="{!v.simpleRecord.Loan_Guid__c}"/> <aura:attribute name="fileCreated" type="Boolean" default="{!v.guid != '' ? true : false}"/> ...
0
votes
2answers
29 views

Unable to convert phone to string in apex

I am working on rest API services. I need to push phone number as a string in the body of the request. I tried following way. String Str1=ts.phone.replaceAll('(',''); String Str2=Str1.replaceAll(')',...
1
vote
2answers
181 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 ...
4
votes
1answer
165 views

Accommodate the length of a string value to prevent the STRING_TOO_LONG issue

I received an exception while trying to insert an order item. It appears to be that the description field allows only 255 characters; sometimes my descriptions goes beyond 255. I will shorten the ...
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 ...
1
vote
3answers
667 views

How to sort a list of strings in the descending order?

I'm trying to sort the list of strings which has versions but fail to do this: List<String> src = new List<String>{'7.1.2', '8.1.3', '11.0.5', '5.x', '10.0.89', '12.13.14'}; List<...
2
votes
1answer
119 views

Split a row with data separated by “,”

I need to split a row from a DE. The row contents 4 strings, and I want to see the content in a table. Right now I have some code; but doesn't work: Script %%[ VAR @Productos<br/> SET @...
0
votes
1answer
1k views

String replace double quotes & slash

I'm trying JSON Parser and in the JSON I've \" (for like <tag style=\"color: #fff;\"...) If I can replace \" with \\" the parser works fine (like in this - https://developer.salesforce.com/forums/?...
0
votes
2answers
165 views

How to replace both space and newline form the string using regex

lstIQCodes = IQcodeString.replaceAll(' ','').split(','); I have tried the above code and able to replace spaces and now I want to replace newline as well.
2
votes
1answer
277 views

Date Json.serialize removes 00:00:00 digits from datefields of object

I have the following object (invMappingNew): {customerId__c=1, addressId__c=8212BJ154, invoiceType__c=AdvancePayment, invoiceTypeLocalized__c=Voorschot, invoiceDate__c=2015-02-13 00:00:00, ...
2
votes
1answer
617 views

How to return Json string

I have a Get Method which returns an invoice based on id. When I test this with Workbench I would like to have the following response: { "customerId": "1", "addressId": "2018AA123", "invoiceId": "...
1
vote
2answers
554 views

isNotBlank(inputString) vs isNotEmpty(inputString)

For string in Apex code, I can see two functions to check if string has any value or not: isNotBlank(inputString) and isNotEmpty(inputString). I have following questions regarding two similar looking ...
2
votes
1answer
502 views

Convert Schema.SObjectfield to string

I have a List of Schema.SObjectfield and I want to convert it to String. I am getting below error. System.JSONException: Apex Type unsupported in JSON: Schema.SObjectField Here is my approach. ...
2
votes
1answer
387 views

JSONGenerator writeObjectField() remove backslashes

I'm trying to create an Invocable Method which allows an input of a JSON-formatted string from Process Builder as a variable. However, when I try to add the inputted JSON string using JSONGenerator....
2
votes
1answer
241 views

How do I check if substring is out of bounds?

I'm trying to find a way to check if a substring causes an out of bounds error in an If statement This is what I have got so far but if the original string has less than 8 characters after substring ...
1
vote
1answer
862 views

Parsing of JSON where a key contains spaces

I am trying to deserialize this response { "invoiceList":[ { "totalPrice":5.5, "statementDate":"2011-10-04T16:58:54.858Z", "lineItems":[ { ...
3
votes
2answers
608 views

How to Pass in an Array of Strings in a Method Parameter in a Test Class

I'm writing a test class right now, and I'm calling a method in the class that I am wanting to test. The method in the main class that I'm wanting to test is called getTruckerAvailability(). Here is ...
0
votes
1answer
38 views

how to get perticular string from json String

Below is my json string getting response from server. in this strig i want alternateLink String part which is "https://drive.google.com/file/d/2ferg6YSxertrewtaN_1iZc/view" how i can get this in ...
1
vote
1answer
31 views

Convert String to Method for use with Datetime

How do I convert a string into a method? I am building a method in a string using custom setting variables. Datetime now = Datetime.now(); update_settings__c updateSettings = [SELECT ...
0
votes
1answer
18 views

Substring based on a word and immediate next third bracket

I have a large text value as below in a custom field of a custom object. FINDDATA: [XY_8852376....... {name:"State__SKN", "data": "State__SKN", defaultContent: '', className:"frozencolumnscolor", ...
2
votes
1answer
67 views

How do I set a string field to null in a Big Object using Apex?

Is that something that is not allowed? Is it a bug? I just tried and it did not seem to set anything. The index of Named_Entity_Big__b is over the following, and I'd like to set Result__c to null: ...
0
votes
2answers
89 views

How to make apex class dynamically AuraEnabled

I am trying to add @AuraEnabled annotation to apex class dynamically without any manual intervention. I have used below soql to fetch the body of the apex class. ApexClass classNameList = [SELECT ...
0
votes
1answer
371 views

Check For Special Characters in Emails

I'm having a business requirement of searching special characters in Email Field(before @domain.com)in a trigger. For Ex: if a email is like this (t#@est@gmail.com).it should be able to identify the'#...
0
votes
3answers
36 views

unable to convert string to integer datatype

I'm trying to convert String to Integer datatype. But I'm unable to convert. I know its simple, but getting me problem here. It giving me below error FATAL_ERROR|System.TypeException: Invalid ...
3
votes
1answer
409 views

Using single quote by curly braces in String.format in Dynamic SOQL

I'm struggling to use String.format to replace a token with a value when the token is within single quotes: Example: String query = String.format('SELECT Id FROM Availability WHERE Person__c = \'{0}\...
1
vote
1answer
299 views

Facing “common.apex.runtime.impl.ScalarList@a1324f1f”

I have a child object to contact called"ObjectA".I have a discipline field(text) in the child object and I have the same field in Contact too.Now If I insert 4 child records with different contact ids,...
2
votes
1answer
23 views

How To get dom documenet value list

Http h = new Http(); HttpRequest req = new HttpRequest(); req.setMethod('POST'); req.setHeader('Content-Type', 'text/xml'); req.setHeader('SOAPAction', action); req.setEndpoint(ep);...
0
votes
1answer
256 views

System.QueryException: unexpected token: :

I have a class where I get 2 variables from a lightning component as a string which works fine. When I try to pass these variables from my testclass I get the error System.QueryException: unexpected ...
-3
votes
1answer
177 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 ...