recStrTok - % until the delimiter is reached. The token...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% 10/22/2009 3:34 AM % Function Name: recStrTok % Inputs: char - the string that a token will be taken from % char - a character that will be used as a delimiter % Outputs: char - the first token in the inputted string up to the first % delimiter % char - the remaining portion of the string % % Function Description: Write a function called recStrTok that will take in % a string and a delimiter and return the first token in this string up to % the delimiter. The delimiter should be a single character. % % The token is the first collection of characters in the string leading up
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % until the delimiter is reached. The token does not include the delimiter % (unlike the actual strTok). % function [tok rest] = recStrTok(str, delim) if isempty(str) tok = ''; rest = ''; elseif str(1)==delim tok = ; if length(str)==1 % found in last letter rest = ''; elseif str(2)==' ' rest = str(3:end); else rest = str(2:end); end elseif length(str)==1 % last letter and not found tok = ''; rest = ''; else % not found [temp1, temp2] = recStrTok(str(2:end), delim); tok = [str(1) temp1]; rest = temp2; end...
View Full Document

This note was uploaded on 10/27/2009 for the course CS 1371 taught by Professor Stallworth during the Spring '08 term at Georgia Institute of Technology.

Ask a homework question - tutors are online