One of the things that I have noticed about bitwise operations in JavaScript is that it can be convenient for smaller values, but doesn’t always work for larger values. The reason this is the case is because bitwise operators will only work fully for operands which can be fully expressed in a 32-bit signed format. In other words, using bitwise operations will only produce numbers that are in the range of -2147483648 (-231) to 2147483647 (231 – 1). In addition, if one of the operands used is outside of that range, the last 32 bits of the number will be used instead of the specified number. Therefore, in order to represent a terabyte in JavaScript while using the left shift operator (<<), you would need to do something like the following: [code language="javascript"] (1 << 30) * (1 << 10) // same as Math.pow(2, 40) [/code] If you are not familiar with bitwise operators in JavaScript, I suggest taking a look at this page from Mozilla’s Developer Network.
Blog
Salesforce – Apex – Working With Regular Expressions
Regular expressions are a great way to parse, match and modify strings of all sorts. Let’s learn some different ways that we can use them in Apex by way of some examples that you can Read more…