0
var index=2;
var validFor="CAAA";
function isDependentValue(index, validFor)
{
   var base64 = new sforce.Base64Binary("");
   var decoded = base64.decode(validFor);
   var bits = decoded.charCodeAt(index>>3);

   return ((bits & (0x80 >> (index%8))) != 0);
}

The above code is written in Javascript.I have to do the same in my iOS app.How can i do it with Objective-c.I have decoded the validFor string by using of this POST

Need help on this

Community
  • 1
  • 1
vinay
  • 1,276
  • 3
  • 20
  • 34

1 Answers1

0

If you are looking to convert a string to base64, the code below shows a brief example:

NSData *nsdata = [@"String to encode"
  dataUsingEncoding:NSUTF8StringEncoding];

// Get NSString from NSData object in Base64
NSString *base64Encoded = [nsdata base64EncodedStringWithOptions:0];
John Muchow
  • 4,798
  • 8
  • 40
  • 40