To: J3 J3/18-127 From: Steve Lionel Subject: Additional string intrinsics Date: 2018-February-14 Introduction ------------ String processing has always been a weak point in Fortran, especially compared to other languages. ISO/IEC 1539-2: 2000 (Varying Length Character Strings, N1375) defined various procedures, some of which made it into the standard and some did not. This paper suggests new intrinsic functions that would be useful in applications doing string processing. From N1375 - these are provided as examples of useful functionality, not necessarily the exact specification desired: INSERT - Inserts a substring into a string at a specified position. REMOVE - Removes a specified substring from a string. REPLACE - Replaces a subset of the characters in a string by a given substring. The subset may be specified either by position or by content. SPLIT - Split a string into substrings based on a delimiter. Other functions that would be useful: - Upcase/downcase - Case-insensitive compare - Something like PHP's explode/implode that convert a string to/ from an array of strings with a delimiter. The SPLIT interface might be more practical for Fortran, which doesn't have arrays of varying-length strings. Many users have asked for a function like C's sprintf, saying that internal WRITE is too awkward, especially when one wants to use it in expressions.