summaryrefslogtreecommitdiff
path: root/matlab/lib/+Ice/stringToProtocolVersion.m
blob: 5d2abe322851c11af1060736a1445e32e1030fb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
%{
**********************************************************************

Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.

This copy of Ice is licensed to you under the terms described in the
ICE_LICENSE file included in this distribution.

**********************************************************************
%}

function r = stringToProtocolVersion(s)
    tokens = regexp(s, '^([0-9]+)\.([0-9]+)$', 'tokens');
    if isempty(tokens)
        throw(MException('Ice:ArgumentException', 'expecting a version in X.Y format'));
    end
    r = Ice.ProtocolVersion(str2num(tokens{1}{1}), str2num(tokens{1}{2}));
end