• Check if String contains Number in PowerShell
    14 February

    Check if String Contains Number in PowerShell

    Using Regular Expression We use regular expressions whenever we are required to look for specific patterns in the text. The regular expressions, also known as regex, comprise operators, literal characters, and other constructs. PowerShell has various cmdlets and operators that allow us to use regex with them; some of them are given below: Using -match […]

  • Split String into Variables in PowerShell
    14 February

    PowerShell – Split String into Variables

    Using Split() Method Use the Split() method to split the given string into two variables. [crayon-6769fa329b271838289144/] [crayon-6769fa329b276325392842/] The Split() method is used to split the specified string into two/multiple variables and an array of substrings. In the above example code, the Split() method took two arguments, whitespace as a separator (you can use -, ., […]

  • Merge multiple CSV Files in Python
    14 February

    Merge Multiple CSV Files in Python

    Using pd.concat() Method To merge multiple CSV files in Python: Create a list containing all CSV files we will merge. Create an empty dataframe. Use the for loop to iterate over the files. In each iterate, use read_csv() to read CSV files and concatenate using the pd.concat() method. Use to_csv() to write merged data into […]

  • Compare Arrays in PowerShell
    14 February

    Compare Arrays in PowerShell

    In this post, we will see how to compare Arrays in PowerShell. PowerShell supports arrays with one or more dimensions and zero to many elements in each dimension. Elements inside a dimension are numbered from 0 in ascending integer order. In addition, the array subscript operator [] allows access to any particular element. PowerShell may […]

  • Create temp directory in PowerShell
    14 February

    Create Temp Directory in PowerShell

    Using [System.IO.Path]::GetTempPath() Method with New-Item cmdlet Use the [System.IO.Path]::GetTempPath() with New-Item cmdlet to create a temporary directory in PowerShell. [crayon-6769fa329b828388613271/] [crayon-6769fa329b82c669699122/] First, we used the GetTempPath() method of the System.IO.Path class to get the path of a current user’s temporary folder. This method returned a string type value, which we stored in the $temporaryPath variable. […]

  • Remove Character from String in PowerShell
    14 February

    Remove Character from String in PowerShell

    Remove Character from String in PowerShell Using Replace() Method Use the Replace() method to remove character from a string in PowerShell. Replace() method replaces old character with new Character in the String. [crayon-6769fa329b9b7786788912/] [crayon-6769fa329b9bd955290945/] For the above code, we used the Replace() method to replace Character a with empty space which eventually remove character from […]

  • Count Files in Directory in Java
    14 February

    Count Files in Directory in Java

    Using java.io.File Class Before moving forwards, it is important to know the available items in the current directory. You may also create the same structure to follow along with this article. Our current directory (E:\Test) has the following structure: E:\Test – It has seven items, four text files and three folders (FolderA, FolderB, FolderC, File1.txt, […]

  • Count occurrences of character in String in PowerShell
    14 February

    Count Occurrences of Character in String in PowerShell

    Using the -replace Operator To count the occurrences of a character in a String in PowerShell: Use the -replace operator to replace the occurrences of the specified character with an empty string and store the result in a temporary string. Use the .Length property to get the length of the original and the temporary string. […]

  • Count Files in Directory in Python
    13 February

    Count Files in Directory in Python

    Using os Module We can use the listdir(), scandir(), and walk() methods of the os module to count files in the current directory, including/excluding sub-directories. Before diving into the details, let’s look at the directory structure we will use for this article; you may use your own. E:\Test – contains two text files (File1.txt and […]