缺少 Return 并且 Float 应该是 Int

Missing Return and Float should be Int

我有这样的代码块,我正试图摆脱 Float should be Int 和 Missing Return 错误。

   package com.bykd.dev;

        @:final class Version
        {

            public static inline var SPLIT_CHAR : String = ".";

            public static var revisionKeyword : String = "Revision"; 

            private var _tag : String;

            private var _numbers : Array<Dynamic>;

 public static function create(pfx : String, rev : String = null, sfx : String = null) : Version
    {
        var nums : Array<Dynamic> = null; 
        nums = pfx.split(SPLIT_CHAR);
        if (rev != null)
        {
            nums.push(trimRevision(rev));
        }
        return new Version(nums, sfx);
             private static function trimRevision(rev : String) : String
            {
                var beg : Float = Math.NaN;
                var end : Float = Math.NaN; 
                beg = Std.string("$" + revisionKeyword + ": ").length; 
                end = rev.lastIndexOf(" $");
                return rev.substring(beg, end);   
            } 
        }

错误在最后几行:

  end = rev.lastIndexOf(" $");
                return rev.substring(beg, end);  

非常感谢任何帮助。

为什么要使用浮点数?

var beg : Int = 0;
var end : Int = 0;

尽可能避免动态

var nums : Array<String> = null; 
nums = pfx.split(SPLIT_CHAR);