summaryrefslogtreecommitdiff
path: root/matlab/lib/+Ice/stringToEncodingVersion.m
blob: d0c61f5bf72bb7c232ad8229ce52112eb7691156 (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 = stringToEncodingVersion(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.EncodingVersion(str2num(tokens{1}{1}), str2num(tokens{1}{2}));
end