Month: September 2018
-
JavaScript: String.replace()
The string replace method searches a string for a specified value and replaces it with a provided data. A new replace string will be returned.
-
How to set up a simple web server in mac OS ?
We can set up a simple web server from any directory in mac OS by using the following command. Go to the directory from which we want to run the web server in terminal. Type the above line and the web server will start to run. We can change the port number(9001) as required.
-
Swift: Functions Variadic parameters
We use a variadic parameter when that parameter accepts more than one value as input values when the function is called. Include (…) this after the parameter’s type name to indicate that the parameter is a variadic type.
-
Swift: Function Argument labels and Parameter names
Each function parameter has both argument label and parameter name. Argument label is used in function call and parameter name is used in function implementation. By default parameters use their parameter name as their argument label.
-
Swift: How to add extra zeroes to binary numbers?
We have to manually code to add extra zeroes to the binary number to make them as 8 digits.
-
Swift: How to convert integer to a binary number?
We can convert a integer number to a binary number using radix method available in String.
-
Swift: Advanced operator – bitwise XOR operator
Swift provides XOR ( ^ ) operator which compares two numbers and returns a new number in which the bits are set to 1 when the corresponding bits in the numbers are not equal and bits are set to 0 when the bits in those numbers are same.
-
Swift: Advanced operator – bitwise OR operator
Swift provides bitwise OR ( | ) operator. The OR operator returns a new number with bits set to 1 only when either of the bits present in the two numbers is equal to 1.
-
Swift: Advanced operator – bitwise AND operator
Swift provides bitwise AND ( & ) operator. The AND operator combines the bits of two numbers and returns a new number with bits set to 1 only when both the bits in those numbers are equal to one.
-
Swift: Advanced operator – bitwise NOT operator
Swift provides advanced operators such a s bitwise operators. The bitwise NOT ( ~ ) operator inverts all bits in a number.