問題タブ [string-math]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
2 に答える
6255 参照

sql-server-2005 - TSQL-文字列内で最初に出現する値を検索する

AddrZipという列に対して単純なselectステートメントを実行して、列の最初のスペースの後に「1/2」を含むすべてのレコードを表示する必要があります。Access 2007では、次のようになります。
**Left([Names],InStr(1,[Names]," ")-1)ただし、SQL2005でそれを行う方法を見つけることができません。すべてのヘルプに感謝します。

0 投票する
3 に答える
1961 参照

c# - 動的文字列のテキストの一部を置き換える

この文字列の例を見てみましょう:

D:/firstdir/Another One/and 2/bla bla bla/media/reports/Darth_Vader_Report.pdf

パスの最初の部分を切り取りたい:

D:/firstdir/Another One/and 2/bla bla bla

に置き換え**../**、パスの 2 番目の部分を保持します ( media/reports/Darth_Vader_Report.pdf)

長さやサイズがわかっていれば、Replaceまたはを使用できますSubstring。しかし、文字列の最初の部分は動的なので、どうすればよいでしょうか?


アップデート

StriplingWarrior の質問の後、私はもっとうまく説明できたはずだと気づきました。

目的は、背後のすべてを置き換えること/mediaです。「メディア」ディレクトリは静的であり、常にパスの決定的な部分になります。

0 投票する
1 に答える
69 参照

java - 2 つの JSON 間の一致を判断する方法は?

2 つのデータ ソースがあり、どちらも JSON を返します。

2 つの JSON を照合して 1 つのレコードに格納するために、2 つの JSON に一定の割合の一致 (場合によってはデータの重複) があることを確認したいと考えています。

2 つの文字列のエントロピーを比較するのが最善の方法ですか? 他の解決策はありますか?私はJavaを使用していますが、同じためにscalaを使用することもできます.

0 投票する
4 に答える
249 参照

matlab - この strfind ループをベクトル化します

このループをベクトル化しようとしています:

indicesneedle次に、の各行の開始位置が含まれますhaystack(行ごとに異なる回数になる可能性があります):

strfindベクトル化されている限り、任意のコマンドで実行できますが、そうである必要はありません。

0 投票する
1 に答える
57 参照

r - 'R' での文字列操作 , ある文字列を他の文字列から減算する必要があります. リストの A - B を見つけます

両方のリストを減算してコモンを削除したかったので、文字列を取得する出力が必要でした。

0 投票する
3 に答える
114 参照

c# - How can I perform a mathematical calculation on real numbers stored as strings?

I have a class that contains values that are sometimes monetary values (such as 1.25, 2.50, 10.00, etc.) but can also be the string "N/A"; thus, they are declared as string:

However, this code, meant to store the monetary value (as a string) where that makes sense, and otherwise set the val to "N/A":

...fails to compile, telling me, "Operator '-' cannot be applied to operands of type 'decimal' and 'string'"

So this is my logic:

If the "if" block is entered, that means Week1PriceCraftworks and Week2PriceCraftworks contains numerical values represented as strings, such as "5.00" and "3.14"

I then convert "5.00" to 5 and "3.14" to 3.14 using the Convert.ToDecimal() calls. That should produce a value of 1.86 which is then converted to string ("1.86") so that the correct data type is assigned to pvde.VarianceCraftworks.

But, reasonable and straightforward as that seems to me, I get that err msg. What is wrong with my approach?

BTW, the "week1" and "week2" values are set by calling a method that ends this way:

...so what is contained in Week1PriceCraftworks and Week2PriceCraftworks are either real values (stored as strings) or "N/A".