In this post, we will explore a flexible utility function for splitting a string based on a given delimiter using C++ and the standard library. This allows us to break down complex strings into smaller parts that are easier to process and manipulate. The C++ Utility Function to Split a String by Another String Background:
Read more
Tag: split
Linux Kernel 4.19.178 Release
Posted onThis post summarizes Linux Kernel new features, bugfixes and changes in Linux 4.19.178 Release. Linux 4.19.178 Release contains 248 changes, patches or new features. In total, there are 239,909 lines of Linux source code changed/added in Linux 4.19.178 release compared to Linux 4.19 release. To view the source code of Linux 4.19.178 kernel release online,
Read more
How to escape the XML CData section ending sequence `]]>`?
Posted onHow to escape the XML CData section ending sequence ]]>? The ]]> sequence itself may be part of the content in a CData section. One solution is to split the ]]> token into 2 CData sections. <![CDATA[to split the ]]]]><![CDATA[> token ]]>
How to split and iterate a string separated by a specific character in C++?
Posted onHow to split and iterate a string separated by a specific character in C++? For example, “a string separated by space” by ‘ ‘=> [“a”, “string”, “separated”, “by”, “space”] and “a,string,separated,by,comma” by ‘,’ => [“a”, “string”, “separated”, “by”, “comma”] C++ standard library’s getline() function can be used to build a function. getline() can accept a
Read more
How to split a string by string in Python?
Posted onHow to split a string by string in Python? For example, “a string separated by space” => [“a”, “string”, “separated”, “by”, “space”] and “a,string,separated,by,comma” => [“a”, “string”, “separated”, “by”, “comma”] Python’s string.split() standard library function, if provided a separator, will split the string by the separator, for example >>> str2 = “a,string,separated,by,,,comma” >>> str2.split(“,”) [‘a’,
Read more
How to split a gzip file to several small ones on Linux?
Posted onI have a very large (e.g. 100GB) .gz file and would like to split it into smaller files like 8GB/each for storage/copying. How to split a gzip file to several small ones on Linux? You may use the tool split to split a file by sizes. An example to split a large.tgz to at most
Read more
How to split a string by string in Bash?
Posted onHow to split a string by string in Bash? For example, “a string separated by space” => [“a”, “string”, “separated”, “by”, “space”] and “a,string,separated,by,comma” => [“a”, “string”, “separated”, “by”, “comma”] You can convert a string to an array using the grammar like inarr=(${a}) If the delimiter is not space and delimiter is a single character
Read more
How to delete or get the number in the tail from a string in shell script?
Posted onHow to delete or get the number in the tail from a string in shell script (bash script)? Okay to call other tools. For example, from “/dev/sda8”, I want to get “/dev/sda” and “8” separately. This can be achieved by using sed as follows. To get the string after deleting the tailing numbers, we can
Read more
How to split a string by string in PHP?
Posted onHow to split a string by string in PHP? For example, “a string separated by space” => [“a”, “string”, “separated”, “by”, “space”] and “a,string,separated,by,comma” => [“a”, “string”, “separated”, “by”, “comma”] The commonly used `explode()` is not enough here because multiple delimiters should be consider as one (such as ” “, 3 spaces together, is consider
Read more
How to handle spaces in paths with rsync on Linux?
Posted onThe common rsync commands seems not handle spaces well. For example, rsync -avxP file “user@server:/data/my dir” It reports: rsync: link_stat “/home/zma/file” failed: No such file or directory (2) How to make rsync handle spaces well? You can use the –protect-args option of rsync. $ rsync –protect-args -avxP file “user@server:/data/my dir” What does –protect-args do: -s,
Read more
How to get file extension in JavaScript?
Posted onHow to get file extension from a file name in JavaScript? For examples, For “file.txt”, I want to get “txt”. For “file2.multi.ext.fileext”, I want to get “fileext”. This JavaScript function works well for me. function getExt(filename) { var idx = filename.lastIndexOf(‘.’); // handle cases like, .htaccess, filename return (idx < 1) ? “” : filename.substr(idx
Read more
How to adjust the system partition (C:) size of Windows?
Posted onThe disk management tools of Windows can adjust it to some level. But there are more space available as far as I can tell. How to further adjust the system partition (C:) size of Windows? You may check these tools: EASEUS Partition Master (free) Includes Partition Manager, Disk & Partition Copy Wizard and Partition Recovery
Read more
How to make thunderbird not wrap lines automatically?
Posted onHow to make thunderbird not wrap lines automatically? Check Making Thunderbird Not Wrap Lines Automatically: Setting mail.compose.wrap_to_window_width to true.
How to split a text file by lines on Linux?
Posted onHow to split a text file by lines on Linux? For example, to split a file content.txt into many files and each split contains 1024 lines. You can use the split command on Linux: split -l 1024 content.txt splitted-content.txt- It will generate splitted-content.txt-{aa,ab,….}
How to convert a latex file to a single page html
Posted onHow to convert a latex file to a single page html? htlatex is a good choice. On Fedora, install it by yum install texlive-tex4ht. To generate the HTML page from a latex file doc.tex: htlatex doc You can use the latex2html (can be installed on Fedora by yum install latex2html). $ latex2html -split +0 -info
Read more
Installing Latex and Compiling a Latex Docuent in Linux
Posted onLatex is a popular document preparation system that is widely used for creating scientific and technical documents. Compiling Latex documents on Linux is a straightforward process that requires only a few Latex packages and a set of commands. By following the steps outlined in this post, you can easily compile Latex documents on your Linux
Read more
Parameterised AngularJS Routing in Asp.net MVC using $routeProvider
Posted onIn this post, asp.net development India based professionals will brief you about the interesting feature of AngularJS, that I Routing. You will learn the method to split the single page into multiple views. For more info, read the article. In this article we are going to see one of the most useful feature of AngularJS
Read more
Hadoop Installation Tutorial (Hadoop 2.x)
Posted onHadoop 2 or YARN is the new version of Hadoop. It adds the yarn resource manager in addition to the HDFS and MapReduce components. Hadoop MapReduce is a programming model and software framework for writing applications, which is an open-source variant of MapReduce designed and implemented by Google initially for processing and generating large data
Read more