Tutorial by Examples: ast

C++14 In C++14, this is easily done by std::mismatch which returns the first mismatching pair from two ranges: std::string prefix = "foo"; std::string string = "foobar"; bool isPrefix = std::mismatch(prefix.begin(), prefix.end(), string.begin(), string.end()).first == ...
Below is a recursive code to reverse a string /** * Just a snippet to explain the idea of recursion * **/ public class Reverse { public static void main (String args[]) { String string = "hello world"; System.out.println(reverse(string)); //prints dlrow oll...
VBA is compiled in run-time, which has a huge negative impact on it's performance, everything built-in will be faster, try to use them. As an example I'm comparing SUM and COUNTIF functions, but you can use if for anything you can solve with WorkSheetFunctions. A first attempt for those would be t...
First, instantiate a Toast object with one of the MakeText() methods. This method takes three parameters: the application Context, the text message, and the duration for the toast. It returns a properly initialized Toast object. You can display the toast notification with Show(), as shown in the fol...
The R-Logo is a multilayer raster file (red, green, blue) library(raster) r <- stack("C:/Program Files/R/R-3.2.3/doc/html/logo.jpg") plot(r) The individual layers of the RasterStack object can be adressed by [[. plot(r[[1]])
In this example our project name is "helloworld" which was created with stack new helloworld simple First we have to build the project with stack build and then we can run it with stack exec helloworld-exe
fastlane is an open source build automation tool for Android and iOS for developers. It reduce your build generation time. It is a command line tool that uses Ruby, so you need Ruby on your computer. Most Macs already have Ruby installed by default. Install fastlane Open a terminal. Run sudo ge...
Const baseString As String = "Hello World" Dim charLength As Long charLength = Len(baseString) 'charlength = 11
Const baseString As String = "Hello World" Dim byteLength As Long byteLength = LenB(baseString) 'byteLength = 22
Dim lineOfHyphens As String 'Assign a string with 80 repeated hyphens lineOfHyphens = String$(80, "-")
The System.String class supports a number of methods to convert between uppercase and lowercase characters in a string. System.String.ToLowerInvariant is used to return a String object converted to lowercase. System.String.ToUpperInvariant is used to return a String object converted to upper...
Consider the Node class having 3 members data, left child pointer and right child pointer like below. public class Node { public int data; public Node left; public Node right; public Node(int data){ this.data = data; } } We can traverse the tree construct...
While implementing one of the standard hashing algorithm in awk is probably a tedious task, defining a hash function that can be used as a handle to text documents is much more tractable. A practical situation where such a function is useful is to assign short ids to items given their description, ...
The C standard says that files should end with a new line, so if EOF comes at the end of a line, that line may not be missed by some commands. As an example: $ echo 'one\ntwo\nthree\c' > file.txt $ cat file.txt one two three $ while read line ; do echo "line $line" ; done <...
To get First object: MyModel.objects.first() To get last objects: MyModel.objects.last() Using Filter First object: MyModel.objects.filter(name='simple').first() Using Filter Last object: MyModel.objects.filter(name='simple').last()
select '123' * 2; To make the multiplication with 2 MySQL automatically converts the string 123 into a number. Return value: 246 The conversion to a number starts from left to right. If the conversion is not possible the result is 0 select '123ABC' * 2 Return value: 246 select 'A...
perl -0777 -ne'print "The whole file as a string: --->$_<---\n"' Note: The -0777 is just a convention. Any -0400 and above would de the same.
genRandom creates a stream of random numbers that has a one in four chance of terminating each time it's called. def genRandom: Stream[String] = { val random = scala.util.Random.nextFloat() println(s"Random value is: $random") if (random < 0.25) { Stream.empty[String] ...
In SQL Server 2016 finally they have introduced Split string function : STRING_SPLIT Parameters: It accepts two parameters String: Is an expression of any character type (i.e. nvarchar, varchar, nchar or char). separator : Is a single character expression of any character type (e.g. nv...
NSAttributedString (and its mutable sibling NSMutableAttributedString) allows you to create strings that are complex in their appearance to the user. A common application is to use this to display a string and adding custom kerning / letter-spacing. This would be achieved as follows (where label ...

Page 12 of 26