Tutorial by Examples: st

To match something that does not contain a given string, one can use negative lookahead: Regex syntax: (?!string-to-not-match) Example: //not matching "popcorn" String regexString = "^(?!popcorn).*$"; System.out.println("[popcorn] " + ("popcorn".matches(r...
lib.rs: pub fn to_test(output: bool) -> bool { output } Each file in the tests/ folder is compiled as single crate. tests/integration_test.rs extern crate test_lib; use test_lib::to_test; #[test] fn test_to_test(){ assert_eq!(to_test(true), true); }
It is possible to define custom string interpolators in addition to the built-in ones. my"foo${bar}baz" Is expanded by the compiler to: new scala.StringContext("foo", "baz").my(bar) scala.StringContext has no my method, therefore it can be provided by implicit c...
Since JUnit is a Java library, all you have to do to install it is to add a few JAR files into the classpath of your Java project and you're ready to go. You can download these two JAR files manually: junit.jar & hamcrest-core.jar. If you're using Maven, you can simply add in a dependency into...
In themes.xml: <style name="AppTheme" parent="Theme.AppCompat"> <!-- Theme attributes here --> </style> In AndroidManifest.xml: <application android:icon="@mipmap/ic_launcher" android:label="@string/app_name" andr...
In themes.xml: <style name="MyActivityTheme" parent="Theme.AppCompat"> <!-- Theme attributes here --> </style> In AndroidManifest.xml: <application android:icon="@mipmap/ic_launcher" android:label="@string/app_name" ...
Have required JavaScript and CSS files included in your index.html. You can do this by either using the CDN files availiable at the following paths: <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.12/css/jquery.dataTables.css"> <scr...
XML elements often nest, have data in attributes and/or as character data. The way to capture this data is by using ,attr and ,chardata respectively for those cases. var doc = ` <parent> <child1 attr1="attribute one"/> <child2>and some cdata</child2> </p...
package main import ( "log" "sync" "time" ) func main() { // The WaitGroup lets the main goroutine wait for all other goroutines // to terminate. However, this is no implicit in Go. The WaitGroup must // be explicitely incremented pr...
/** * Created by Alex Sullivan on 7/21/16. */ public class Foo implements Parcelable { private final int myFirstVariable; private final String mySecondVariable; private final long myThirdVariable; public Foo(int myFirstVariable, String mySecondVariable, long myThirdVariab...
Inline style You can manipulate the inline CSS style of an HTML element by simply reading or editing its style property. Assume the following element: <div id="element_id" style="color:blue;width:200px;">abc</div> With this JavaScript applied: var element = doc...
Since all lifecycle hooks in Vue.js are just functions, you can place any of them directly in the instance declaraction. //JS new Vue({ el: '#example', data: { ... }, methods: { ... }, //LIFECYCLE HOOK HANDLING created: function() { ...
import "reflect" type S struct { A int b string } func (s *S) String() { return s.b } s := &S{ A: 5, b: "example", } indirect := reflect.ValueOf(s) // effectively a pointer to an S value := indirect.Elem() // this is addressable, since we've derefed a point...
Directives comes with the AngularJS library itself. A sample directive can be created as: angular.module('simpleDirective', []) .directive('helloData', function() { return { template: 'Hello, {{data}}' }; }); And can be used as: JS: angular.module('app', ['simpleDirective']) .con...
In C# (and .NET) a string is represented by class System.String. The string keyword is an alias for this class. The System.String class is immutable, i.e once created its state cannot be altered. So all the operations you perform on a string like Substring, Remove, Replace, concatenation using + o...
You can install Json.Net into your Visual Studio Project in 1 of 2 ways. Install Json.Net using the Package Manager Console. Open the Package Manager Console window in Visual Studio either by typing package manager console in the Quick Launch box and selecting it or by clicking View -> O...
The following table shows the keywords for built-in C# types, which are aliases of predefined types in the System namespaces. C# Type.NET Framework TypeboolSystem.BooleanbyteSystem.BytesbyteSystem.SBytecharSystem.ChardecimalSystem.DecimaldoubleSystem.DoublefloatSystem.SingleintSystem.Int32uintSyste...
Immutable types are types that when changed create a new version of the object in memory, rather than changing the existing object in memory. The simplest example of this is the built-in string type. Taking the following code, that appends " world" onto the word "Hello" string ...
This is the flavor of markdown that's used by Stack Overflow and other Stack Exchange sites. When you answer a question or add documentation you use this markdown. This answer is made out of SO markdown See Official Documentation The main things that SO markdown adds are under "Stack Exchan...
You need to find out the IP address of the container running in the host so you can, for example, connect to the web server running in it. docker-machine is what is used on MacOSX and Windows. Firstly, list your machines: $ docker-machine ls NAME ACTIVE DRIVER STATE URL ...

Page 62 of 369