Review the struct today and dig up the little details that you didn't notice before:
Basic definition: Structure, popular speaking is like packaging packaging, some of the common characteristics (such as the attributes belonging to a certain kind of things, often a business-related attribute of aggregation) of variables encapsulated in the internal, through a certain method access to modify internal variables.
structure Body Definition:
The first: Only the definition of the struct body
stru
integer of the enumerated variable. For example, we will:
For (int n = 0; n
If (list. items [n]. e = MyEnum. VAL_X)
// Do stuff 1
Else if (list. items [n]. e = MyEnum. VAL_Y)
// Do stuff 2
}
Replace:
Int valX = MyEnum. VAL_X.ordinal ();
Int valY = MyEnum. VAL_Y.ordinal ();
Int count = list. size ();
MyItem items = list. items ();
For (int n = 0; n
{
Int valItem = items [n]. e. ordinal ();
If (valItem = v
Well, I've found some content on the Internet, and we've integrated some of the built-in methods of SQL Server The first is the Convert method: https://msdn.microsoft.com/zh-cn/library/ms187928.aspx CONVERT (data_type (length),data_to_be_converted,style) This method is equivalent to formatting the date data into a string output. And then the stuff method: https://msdn.microsoft.com/zh-cn/library/ms188043.aspx STUF
page and not modify it to ensure that the user can bookmark the current script state of the page.
6. For the sake of others
(namespaces, scopes, and patterns)
Your code is almost never the only script code in the document. So it's especially important to make sure that you don't have global functions or global variables that other scripts can overwrite in your code. There are some available patterns to avoid this problem, the most fundamental thing is to use the VAR keyword to initialize all
,
name = (
stuff (
Select, ' + name from table_a where category = A. Category for XML Path (')),
1,
1,
'
)
) from
table_a as A Group by category
Here, using the SQL Server 2005 version of stuff and for XML path, let's say the role in the SQL above, and then explain the two uses in more detail.
Copy Code code as follows:
FOR XML Path (')
This sentence is to
Label:
Example
Stuff
FOR XML Path
Reference articles
ExampleThere was a problem with SQL Server yesterday: I had to write a stored procedure to process the data in several tables, and finally the problem was that I wanted to stitch up the rows of one column of a table into a row, such as a table with two columns of data:
category
name
Aaa
Enterprise 1
Aaa
The string truncation function refers to: Stuff and SubString, string lookup functions are: CharIndex and PatIndexOne, SubString intercept sub-stringThe most commonly used string function to intercept substrings of a specific length.SUBSTRING (expression, start, length)Parameter description:
Start parameter: An integer that represents the starting position; The ordinal of the character (index) starts at 1, that is, the ordinal of the first ch
Label:Note: This article is for sharing only, the copyright belongs to the original author. A problem with SQL Server was encountered yesterday: a stored procedure was needed to process the data from several tables, and finally the problem was that I wanted to stitch a row of rows of one column of a table For example, there are two columns of data in the table: Ep_Classes Ep_name AAA Enterprise 1 AAA Enterprise 2 AAA Enterprise 3 BBB Enterprise 4 BBB Enterprise 5 I want to make this table the
Stupid way to learn the 39th verse of PythonBefore the third version of the book, yesterday found that the contents of the wrong, eight abs and gave me the fourth edition, this time the content is on. The code for this section is as follows:1Ten_things ="Apples oranges Crows Telephone light Sugar"2 3 Print "Wait There's not ten things in so list, let's fix that"4 5Stuff = Ten_things.split (' ')6 7More_stuff = [" Day","Night","Song","Frisbee","Corn","Bananan","Girl"," Boy"]8 9 whileLen (
, 2, 3, 4, or 5. Returns True.
String_to_test.test ("[1-5]");
If you want to match in more than one character set, you can put your character set in a square bracket [], and then use the "|" Operators are separated.
Reference code:
Copy Code code as follows:
var string_to_test = "B or 3";
Match A to D or 1 to 5, return True
String_to_test.test ([[a-d] | [1-5]]);
The string to test is one:
The string to test two:
Regular expressions
Ignore case
Escaperegexp (
a problem with SQL Server was encountered yesterday: a stored procedure was needed to process the data from several tables, and finally the problem was that I wanted to stitch a row of rows of one column of a table For example, there are two columns of data in the table:Ep_Classes ep_name AAA Enterprise 1AAA Enterprise 2AAA Enterprise 3BBB Enterprise 4BBB Enterprise 5I want to make this table the following format:Ep_Classes Ep_nameAAA Enterprise 1, Enterprise 2, Enterprise 3BBB Enterprise 4, Ent
instanceof Person = true );Alert (lenel instanceof Object === true );So far, everything is harmonious.The constructor of an object literally points to the Person that constructs it.An object is an instance that constructs its Person ).All objects are Object instances, such as Java.JavaScript provides prototype for method expansion and inheritance.Copy codeThe Code is as follows:Person. prototype. getName = function (){Return this. name};This defines that all objects have the getName method.Of c
);
Alert (lenel instanceof person = true );
Alert (lenel instanceof object === true );
So far, everything is harmonious.The constructor of an object literally points to the person that constructs it.An object is an instance that constructs its person ).All objects are object instances, such as Java.Javascript provides prototype for method expansion and inheritance.Copy codeThe Code is as follows: person. Prototype. getname = function (){Return this. Name};
This defines that all objects have
') , but all you see is mystuff.append (' Hello ') . Code:Ten_things ='Apples oranges Crows Telephone light Sugar'Print("Wait There ' s not things on that list, let's fix that.") Stuff= Ten_things.split (" ") More_stuff=[' Day','Night','Song','Frisbee','Corn','Banana','Girl',' Boy'] whileLen (stuff)! = 10: Next_one=More_stuff.pop ()Print('Adding:', Next_one) stuff.append (next_one)Print("there ' s%d items
functions or global variables in your code. There are some available modes to avoid this problem. The most basic point is to use the var keyword to initialize all variables. Suppose we have written the following script:Copy codeThe Code is as follows:Var nav = document. getElementById ('nav ');Function init (){// Do stuff}Function show (){// Do stuff}Function reset (){// Do
, 13:09:56) [GCC 4.4.3] on linux2Type "help", "copyright", "credits" or "license" for more information.
>>> class Thing(object):... def test(hi):... print "hi"... >>> a = Thing()>>> a.test("hello")Traceback (most recent call last): File "
The exercises below are to mix strings and lists to see if we can find something interesting.
ten_things = "Apples Oranges Crows Telephone Light Sugar" print "Wait there's not 10 things in that list, let's fix that."
take a look at the code below to see what the problem is.
Java code public void dostuffwithstring (String stringparam) {if (Stringparam.equals ("Mystringvalue")) {//do stuff The source code copy print public void dostuffwithstring (String stringparam) {if (Stringparam.equals ("Mystringvalue")) {/ /Do Stuff}}
This may have nullpointerexception appear, then there are several ways to deal with:
Java co
Tags: char variable from image color binary SSE Col Div After using group by to write a statistical statement, there is a need to view the details of each record, The first thing that comes to mind is to splice the query criteria according to the group by condition. But the conditions are a bit more, stitching up not only trouble, but also error-prone, So the idea of having the ID of the detail record in the form of a comma-delimited string (' 1 ', ' 2 ', ' 3 ') is followed by the group by, so i
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.