To get current year in C#/CSharp, we make use of DateTime class. Example is given below. using System; namespace Hello_World { class Program { static void Main(string args) { DateTime current = DateTime.Now; Console.WriteLine(current.Year); } } } ;
To create a text file in C#/CSharp, we make use of File class which contains Create static function. This function will take text file path as parameter where you want to create the text file. using System; using System.IO; namespace Hello_World { class Program { static void Main(string args) { string file = @"C:\Users\ADMIN\Desktop\file.txt"; File.Create(file);
As you know, replace() function is used to replace value in a given string. It also takes regex as parameter to perform the search for replacement. With regex, you can perform 2 kinds of searches, global case-sensitive and global case-insensitive. For global case-sensitive search, we add g at the end of regex and for global
We have couple of functions to manipulate strings in JavaScript. Mostly commonly used functions are given below with example. toUpperCase(): This function will change the case of a string to upper. toLowerCase(): This function will change the case of a string to lower. trim(): This function will remove any extra white space at the start
In JavaScript, we have some characters which have some special meaning. For example, a string is always surrounded by double quotation marks or single quotation marks. First quotation mark determines the start of a string and second quotation mark determines the end of a string. But in case, you want to write a string on