Find your content:

Search form

You are here

Method does not exist or incorrect signature in GUID generator

 
Share

When I use the code for the GUID generator which is present here:

GUID Generator

I am getting this error Method does not exist or incorrect signature: StringUtils.charAt(String, Integer) at line 27 column 28

What why do I get this error?


Attribution to: Eagerin Sf

Possible Suggestion/Solution #1

That's most likely because this GUID generator is cannibalized out of Apex-Lang project (a bunch of utility libraries for SF, in my opinion a bit obsolete in Winter'13).

Try to replace the call with something like yourStringVariable.mid(yourIndexInteger, 1);?


Attribution to: eyescream

Possible Suggestion/Solution #2

In the code in the question you linked to, the charAt() method is included in the class, not in a class called StringUtils, so unless you've put it in a class called StringUtils you'll need to remove that part from the call to the method.

Alternatively, if you have put it in a class called StringUtils, the problem may be that you haven't created an instance of the class:

StringUtils utils = new StringUtils();
utils.CharAt(aString, 4);

In which case, you probably meant to make the method static anyway and forgot the static keyword in the code (the asterisks are for emphasis, they're not part of the code!):

global **static** String charAt(String str, Integer index)

All that aside, if you couldn't fix this yourself then chances are you need to learn a bit more about writing code in Apex before trying to build large pieces of functionality on the platform.


Attribution to: Matt Lacey
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/4134

My Block Status

My Block Content