Tutorial by Examples: ast

stri_paste(LETTERS,"-", 1:13) # [1] "A-1" "B-2" "C-3" "D-4" "E-5" "F-6" "G-7" "H-8" "I-9" "J-10" "K-11" "L-12" "M-13" # [14] "N-1" "...
/// <summary> /// Converts a data type to another data type. /// </summary> public static class Cast { /// <summary> /// Converts input to Type of default value or given as typeparam T /// </summary> /// <typepara...
/// <summary> /// Read configuration values from app.config and convert to specified types /// </summary> public static class ConfigurationReader { /// <summary> /// Get value from AppSettings by key, convert to Type of default value or typ...
array = [1, 2, 3, 4] [first] = array # 1 [..., last] = array # 4 [first, middle..., last] = array # first is 1, middle is [2, 3], last is 4
To call a stored procedure on the server: $query = "{call [dbo].[myStoredProcedure](?,?,?)}"; //Parameters '?' includes OUT parameters $params = array( array($name, SQLSRV_PARAM_IN), array($age, SQLSRV_PARAM_IN), array($count, SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_INT) //$cou...
myString := " hello, Trim()! " trimmed := Trim(myString) FileAppend, % trimmed "`n", TrimmedStrings.txt Note that Trim() will not manipulate the original string, but return a new one which should be stored or output somewhere.
str := base64.StdEncoding.EncodeToString([]byte(`foo bar`)) fmt.Println(str) // Output: Zm9vIGJhcg== Playground
decoded, err := base64.StdEncoding.DecodeString(`biws`) if err != nil { log.Fatal(err) } fmt.Printf("%s", decoded) // Output: n,, Playground
By default, Android will display Toast messages at the bottom of the screen even if the keyboard is showing. This will show a Toast message just above the keyboard. public void showMessage(final String message, final int length) { View root = findViewById(android.R.id.content); Toast toas...
Sometimes you doesn't want to simply replace or remove the string. Sometimes you want to extract and process matches. Here an example of how you manipulate matches. What is a match ? When a compatible substring is found for the entire regex in the string, the exec command produce a match. A match i...
Least squares is a standard approach to problems with more equations than unknowns, also known as overdetermined systems. Consider the four equations: x0 + 2 * x1 + x2 = 4 x0 + x1 + 2 * x2 = 3 2 * x0 + x1 + x2 = 5 x0 + x1 + x2 = 4 We can express this as a matrix multiplication A * x = b: A ...
As a developer, you frequently find yourself dealing with strings that are not created by your own code. These will often be supplied by third party libraries, external systems, or even end users. Validating strings of unclear provenance is considered to be one of the hallmarks of defensive program...
for k in `git branch -a | sed s/^..//`; do echo -e `git log -1 --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k --`\\t"$k";done | sort
NSURL *url = [NSURL URLWithString:@"http://www.example.com/images/apple-tree.jpg"]; NSString *fileName = [url lastPathComponent]; // fileName = "apple-tree.jpg"
To help you find and count characters in a string, CharMatcher provides the following methods: int indexIn(CharSequence sequence) Returns the index of the first character that matches the CharMatcher instance. Returns -­1 if no character matches. int indexIn(CharSequence sequence, int sta...
A StringBuilder represents a series of characters, which unlike a normal string, are mutable. Often times there is a need to modify strings that we've already made, but the standard string object is not mutable. This means that each time a string is modified, a new string object needs to be created,...
In most cases, it is illegal to access an object of one type as though it were a different type (disregarding cv-qualifiers). Example: float x = 42; int y = reinterpret_cast<int&>(x); The result is undefined behavior. There are some exceptions to this strict aliasing rule: An obj...
The ngPaste directive specifies custom behavior to run when a user pastes content <input ng-paste="paste=true" ng-init="paste=false" placeholder='paste here'> pasted: {{paste}}
Set mark in cursor location: C-space or C-@ Kill region (Cut): C-w Copy region to kill ring: M-w or Esc-w Yank (Paste) most recently killed: C-y Yank (Paste) next last killed: M-y or Esc-y Kill killis the command used by Emacs for the deletion of ...
Using the System.String.Replace method, you can replace part of a string with another string. string s = "Hello World"; s = s.Replace("World", "Universe"); // s = "Hello Universe" All the occurrences of the search string are replaced. This method can al...

Page 15 of 26