This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.Text; | |
namespace StringBuilder | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
// นำเข้าคลาส Globalization โดยเรียกผ่านเนมสเปช System.Globalization | |
// เพื่อให้สามารถเรียกใช้คลาส CultureInfo() ได้ | |
using System.Globalization; | |
namespace DateCultureCSharp | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void Form1_Load(object sender, EventArgs e) | |
{ | |
for (int monthNo = 1; monthNo < 12; monthNo++) | |
{ | |
var bar = new DateTime(DateTime.Now.Year, monthNo, 1); | |
listBox1.Items.Add(bar.ToString("MMMM", new CultureInfo("en-US"))); | |
listBox2.Items.Add(bar.ToString("MMMM", new CultureInfo("th-TH"))); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private string GetExcelColumnName(int columnNumber) | |
{ | |
int dividend = columnNumber; | |
string columnName = String.Empty; | |
int modulo; | |
while (dividend > 0) | |
{ | |
modulo = (dividend - 1) % 26; | |
columnName = Convert.ToChar(65 + modulo).ToString() + columnName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var strText = 'Test Replace bear and duck and dog and cat'; | |
var strAfRep = strText.replace('and','or'); | |
console.log(strAfRep); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var strText = 'Test Replace bear and duck and dog and cat'; | |
var strAfRep = strText.replace(/and/g,'or'); | |
console.log(strAfRep); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestStaticMethod{ | |
public static void main(String[] args){ | |
Calculate foo = new Calculate(); | |
int value = foo.bar(10); | |
System.out.println("value = " + value); | |
} | |
} | |
class Calculate{ | |
public int bar(int number){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestStaticMethod{ | |
public static void main(String[] args){ | |
int value = Calculate.bar(10); | |
System.out.println("value = " + value); | |
} | |
} | |
class Calculate{ | |
public static int bar(int number){ | |
return number+10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestModel { | |
private static int value1; | |
private int value2; | |
public static int getValue1() { | |
return value1; | |
} | |
public static void setValue1(int value1) { | |
TestModel.value1 = value1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
public class TestStaticVariable { | |
public static void main(String[] args) { | |
ArrayList < TestModel > modelLst = new ArrayList < > (); | |
for (int i = 0; i < 10; i++) { | |
TestModel model = new TestModel(); |
OlderNewer