extract substring

substr extracts a substring of length len from the string str, starting at the specified offset.
3.9K Downloads
Updated 18 Aug 2009

View License

substr extracts a substring of length len from the string str, starting at the specified offset. In this version, the first character position has offset 1. (In Acklam's original code, the first character position has offset 0, but this is inconsistent with Matlab conventions). If offset is negative, the position is reckoned by counting backwards from the end of the string. If len is omitted, substr returns everything to the end of the string. If len is negative, substr removes -len characters from the end of the string.

Cite As

Phillip M. Feldman (2024). extract substring (https://www.mathworks.com/matlabcentral/fileexchange/25064-extract-substring), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2008b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Characters and Strings in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0