Challenge 3: As Easy as A to B

August 23, 2015


It's back to school already for a lot of young developers out there.  We though this would help them recall some of that knowledge that might have been lost over the summer. 


A... B... shoot, what comes next?




This week's challenge is all about finding the easiest way to increment characters.  How do you increment a string that is set to "A" to "B?"  How about "S" to "T" and so on?


If only if it were as simple as "A" + 1.  Or is it?


In the sample code, you'll be providing the body of a method that accepts two parameters:

  • Letter - a string of a single letter that you'll be incrementing

  • Step - an integer to control how far many steps the starting letter should be shifted.



1)  Only worry about upper case


2)  Z should wrap around to A (X, Y, Z, A, B, ...)


3)  Funny guys/gals out there, A=B and variants aren't accepted!


Expected Results

  • getResult('A', 1) should yield "B" as B is 1 letter after A. 

  • getResult('A',2) should yield "C" as C is two letters after A.  

  • getResult('Z',1) should result in A, per the wrap around rule (#2 above)


Starter Code


You must use the following code and can only add to the code provided below.



Link to Code:  Gist

Please reload

Recent Posts
Please reload

At CRM Science, we use our Salesforce expertise to transform your enterprise. Partnering with our clients throughout the Salesforce journey, we work with leaders to strategize and optimize business processes, and design and develop solutions across every Salesforce cloud. We empower companies to innovate faster, better engage with customers, and improve bottom lines. 

CRM Science is a Salesforce Silver Consulting Partner and a Registered Partner. Our strategic consulting services were recognized by Salesforce in four consecutive Salesforce Partner Innovation Awards, an annual recognition for partners that deliver outstanding client success. 

Helpful Content
Client Success
Connect with us
Email Us
860 First Ave, Suite 2
King of Prussia, PA 19406
(484) 775-0333
  • Twitter
  • Facebook
  • YouTube

Copyright © 2011-2020 CRM Science, Inc. All rights reserved.