将字符串/文本转换为splunk友好格式(Convert a string/text into splunk friendly format)
我需要在运行代码时记录一些细节。 splunk不会为带有空格,引号等的键索引值。是否有任何标准过程可以将任何字符串/文本转换为splunk友好格式。
示例字符串:
key=string1 key=hello word key="Hi, How are you", she exclaimed. key="Wow what a pic!!!!" key=this word means 'hua' in hindi. key=%$^##@@####3
等等
I need to log some details while running my code. The splunk doesn't index values for keys with spaces, quotes etc. Is there any standard procedure where I can convert any string/text to splunk friendly format.
Sample strings :
key=string1 key=hello word key="Hi, How are you", she exclaimed. key="Wow what a pic!!!!" key=this word means 'hua' in hindi. key=%$^##@@####3
etc
原文:https://stackoverflow.com/questions/32242167
更新时间:2022-03-28 19:03
最满意答案
使用
Application.Intersect
,您可以使用以下方法。 示例是VBA,但可以轻松移植到C#。Sub TestinRange() Dim inputRange As Range Set inputRange = Worksheets(1).Range("B1:B5") Dim IsActiveCellInInputRange As Range Set IsActiveCellInInputRange = Application.Intersect(inputRange, ActiveCell) If IsActiveCellInInputRange Is Nothing Then Debug.Print "Nope, the ActiveCell is not within the Input Range" Else Debug.Print "Yep, the ActiveCell is within the Input Range. ActiveCell Address: " & ActiveCell.Address End If End Sub
Here's the way you can do it, using
Application.Intersect
. Example is VBA, but can easily be ported to C#.Sub TestinRange() Dim inputRange As Range Set inputRange = Worksheets(1).Range("B1:B5") Dim IsActiveCellInInputRange As Range Set IsActiveCellInInputRange = Application.Intersect(inputRange, ActiveCell) If IsActiveCellInInputRange Is Nothing Then Debug.Print "Nope, the ActiveCell is not within the Input Range" Else Debug.Print "Yep, the ActiveCell is within the Input Range. ActiveCell Address: " & ActiveCell.Address End If End Sub
相关问答
更多-
Excel公式,用于将单元格与选定范围内的其他单元格进行比较(Excel formula to compare a cell with other cells in a selected range)[2023-06-21]
嗯,我认为这将做你想要的,记住范围可能不是你想要的 =IFERROR((IF(A2=INDEX($A$2:$A$11,MODE(MATCH($A$2:$A$11,$A$2:$A$11,0)+{0,0})),1,0)+IF(B2=INDEX($B$2:$B$11,MODE(MATCH($B$2:$B$11,$B$2:$B$11,0)+{0,0})),1,0))/2,"") 我不确定你在第二部分到底在谈论什么,但也许这可以满足你所需要的一切。 Well I think this will do what yo ... -
你可以试试这个: dim i as integer i = ActiveCell.Row + 1 Excel.ActiveSheet.Cells(i,1).value = "Whatever your value is." The answer is, as usual, easy when you know how. My code a bit further down from the sample in my question looked a bit like this: object act ...
-
您可以使用“公式”功能区的“公式审核”选项卡上的“跟踪先例”功能。 如果Precedent在同一工作表上,单击箭头将带您到那里。 如果Precedent在另一个工作表上,单击公式框中的箭头将弹出一个“GoTo”对话框,然后您可以导航到另一个工作表单元格。 You can use the Trace Precedents feature on the Formula Auditing tab of the Formulas ribbon. If the Precedent is on the same wor ...
-
蒂姆威廉姆斯的暗示做到了诀窍。 谢谢! 以下代码工作: Sub ColorizeCells() Dim Data As Range Dim cell As Range Set Data = Selection For Each cell In Data If Len(cell.Value) > 0 Then cell.Interior.ColorIndex = 4 End If Next End Sub Th ...
-
你想使用ActiveCell.Address它会告诉你一个像$ A $ 1这样的值,你可以在比较中使用它。 尝试此示例代码以查看返回值的格式: Sub selectRange() MsgBox ActiveCell.Address End Sub 对于你的情况,你想要的东西 If ActiveCell.Address = "$C$36" Then You want to use ActiveCell.Address It will tell you a value like $A$1, which you ...
-
将其放置在LookupLists代码部分中(您大概已经这样做了): Private Sub Worksheet_SelectionChange(ByVal target As Range) Dim rng As Range Set rng = Worksheets("LookupLists").Range("Efficient") If Intersect(target, rng) Is Nothing Then Exit Sub Application.EnableEvents = ...
-
您必须从工作簿中获取应用程序对象。 如果要实例化新应用程序,则只能直接使用xw.App 。 此外, selection返回一个Range对象,所以这样做: cellRange = wb.app.selection rowNum = cellRange.row colNum = cellRange.column You have to get the app object from the workbook. You'd only use xw.App directly if you wanted to i ...
-
使用Application.Intersect ,您可以使用以下方法。 示例是VBA,但可以轻松移植到C#。 Sub TestinRange() Dim inputRange As Range Set inputRange = Worksheets(1).Range("B1:B5") Dim IsActiveCellInInputRange As Range Set IsActiveCellInInputRange = Application.Intersect(inputR ...
-
如果您的意思是列末尾的第一个空单元格,则这是所需的轻微变化。 我建议不要使用变量名称Target因为这也是一个VBA关键字。 Dim rng As Range Set rng = Cells(Rows.Count, "A").End(xlUp).offset(1,0) MsgBox rng.Address If you mean the first empty cell at the end of the column then this is the slight variation required. ...
-
没有理由将活动单元格放在A列中以便在MsgBox显示您想要的信息,因此,如果这是您尝试限制ActiveCell位置的唯一原因,您应该能够更改您的代码如下所示: Sub DeleteRow() If ActiveCell.Row <= 8 Then MsgBox "This macro should only be invoked if you are in a non-header row" ElseIf MsgBox("Are you sure you want to de ...