• 16 December

    Convert List to Comma Separated String in Python

    Use .join() Method To convert a list to a comma separated string in Python, use the .join() method. join() method takes all elements in an iterable and joins them into one string with delimiter as separator. [crayon-676d600f0c4c4037306734/] [crayon-676d600f0c4d0592147291/] First, we created a list having string-type elements and named that list list_of_strings. Next, we used the […]

  • 16 December

    Run CMD Command in PowerShell

    1. Introduction PowerShell, a powerful scripting and automation tool by Microsoft, is often used for its advanced features and flexibility. However, there are scenarios where it is necessary to run traditional Command Prompt (CMD) commands within PowerShell. This necessity may arise due to specific CMD functionalities, integration with legacy systems, or compatibility reasons. In such […]

  • 16 December

    Delete All Files in Directory in PowerShell

    This tutorial will discuss how to delete all files in a directory using PowerShell. Using Remove-Item cmdlet To delete all files in a directory: Use the Remove-Item cmdlet. Include asterisk symbol in the file path. [crayon-676d600f0ce02863885006/] The above command removes all content in the directory C:\test. If there are sub-directories in the location, it will […]

  • 16 December

    Write Array to CSV in PowerShell

    This article will explain how to write an array to a CSV file in PowerShell. Using the Export-Csv cmdlet The Export-Csv cmdlet in PowerShell creates a CSV file of the given objects. But you cannot directly write an array to a CSV file correctly. When you pipe the array to Export-Csv, the result will be […]

  • 12 December

    Remove Last Character from String in PHP

    This article explains different ways to remove the last character from a string in PHP Use the substr() function To remove last character from String in PHP, use of the substr() function and pass a negative length value as argument. Here is an example on how to use the substr() function to achieve the operation […]

  • 12 December

    Check if Variable is Array in PHP

    Using the is_array() function To check if variable is array in PHP, use is_array() function. The is_array() function is a built-in function in PHP that takes a variable as an argument and returns a Boolean value indicating whether the variable is an array. Here is an example of how to use this function: [crayon-676d600f0d37f916426569/] Output […]

  • 12 December

    Count Lines in File in PHP

    To count the number of lines in a file in PHP, you can use one of the following approaches: Use the file() function This function reads the entire file into an array, with each line of the file as an element in the array. Then, use the count() function to count the number of elements […]

  • 12 December

    Split String by Comma in PHP

    This article explains how to split a string by comma in PHP using different approaches. Use the explode() function To split string by comma, we can make use of the explode function. This function splits the string by the specified delimiter and returns an array of substrings. Here is example of how to split string […]

  • 09 December

    Count Occurrences of Character in String in Python

    Using count() Method Use String’s count() method to count occurrences of character in String in Python e.g. my_string.count(character). count() method returns number of occurrences of the character in String. [crayon-676d600f0d8e2641547464/] We will get the following result after running the above program. [crayon-676d600f0d8ea169284403/] The count() is a conventional method in Python. It holds a substring, start, […]